admin管理员组文章数量:1323348
I'm using jQuery UI tabs(). It adds "ui-tabs-selected" to the selected LI, but each LI has an ID because it's different. Due to the multi ID/class bug in IE6, I need to apply a "selected" class to the anchor that is inside the "ui-tabs-selected" LI.
Can someone tell me how to do this?
I'm using jQuery UI tabs(). It adds "ui-tabs-selected" to the selected LI, but each LI has an ID because it's different. Due to the multi ID/class bug in IE6, I need to apply a "selected" class to the anchor that is inside the "ui-tabs-selected" LI.
Can someone tell me how to do this?
Share Improve this question asked Apr 23, 2011 at 4:23 CofeyCofey 11.4k16 gold badges54 silver badges75 bronze badges2 Answers
Reset to default 7you can do
$('li.ui-tabs-selected a').addClass('yourclass');
To manually add a class to any of the tabs you can do assuming your ul
has the id #tabs
$('#tabs li a').eq(1).addClass('yourclass'); //this will add class to second tab
Updated Answer
Use the select event to trigger addClass()
$('#wrap').tabs({
select: function(event, ui) {
$(this).find('li a').removeClass('myclass').eq(ui.index).addClass('myclass')
}
});
Check working example at http://jsfiddle/6JryL/
$('.ui-tabs-selected a').addClass('selected');
版权声明:本文标题:javascript - How to add a "selected" class to a selected tab anchor using jQuery UI Tabs? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742132357a2422220.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论