开发者

How do I get the currently selected tab in jQuery for css styling? [duplicate]

开发者 https://www.devze.com 2023-02-21 22:38 出处:网络
This question already has answers here: 开发者_开发技巧 Closed 11 years ago. Possible Duplicate: I need to add custom css to jquery tabs when it is selected, how ?
This question already has answers here: 开发者_开发技巧 Closed 11 years ago.

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".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号