- ##jsp:
<ul class="nav nav-tabs"> <li class="active"> <a href="#tab-1" class="stability-test" data-marker="tab1" data-toggle="tab" aria-expanded="true">tab1</a> </li> <li class=""> <a href="#tab-2" class="stability-test" data-marker="tab2" data-toggle="tab"aria-expanded="false">tab2</a> </li> </ul>Copy after login
Another method is: There is an index() event in jq to obtain the current position. The specific usage is as follows:
- js:
$('.stability-test').click(function(e) { var $this = $(e.target); marker = $this.data('marker'); });Copy after login
$(".class").click(function(){ alert($(this).index()); })//这个弹出的就是点击的class是第几个
The above is the detailed content of Get the clicked tab page through the same class in jQuery. For more information, please follow other related articles on the PHP Chinese website!