Let’s say i have html structure like this:
How can I make a check something like this with jquery: if “tab2” is before “tab3 Active” do something… And if “tab2” is after “tab3 Active” do something else?
Thank you guys!!!
<html>
<head>
</head>
<body>
<ul class="Mytabs">
<li class="tab1"></li>
<li class="tab2"></li>
<li class="tab3 Active"></li>
<li class="tab4"></li>
<li class="tab5"></li>
</ul>
You can use
prev()andnext()to check to see where the element is in relation to another. Try this:Using this method you an easily change the tab you want to inspect, and it doesn’t matter which tab has the
activeclass on it.