How do I get the currently selected tab in jQuery for css styling? [duplicate]
Possible Duplicate:
I need to add custom css to jquery tabs when it is selected, how ?
I have a code to display a message when a tab is selected, but now I want to add a background image to the selected tab when it is being selected.
Here is the code:
<script type="text/javascript">
$(function(){
$("#myTabs").bind("tabsselect", function(e, tab) {
alert("The tab at index " + tab.index + " was selected");
});
$("#myTabs").tabs();
});
</script>
I think something like ($selected tab).css("background-image","url stuff.."); should work but I do not know the syntax for the currently selected tab.
Any Idea ?
See: jQuery UI Tabs Get Currently Selected Tab Index
Also, suggest changing your title to something more appropriate like "How do I get the currently selected tab in jQuery".
精彩评论