开发者

jquery, how to add 2 different variables for the same call?

开发者 https://www.devze.com 2023-02-20 09:33 出处:网络
i have 2 different tabs setup on the page: tabs1 and开发者_JAVA百科 tabs2 i have this set up: $( \'#tabs1\' ).tabs({

i have 2 different tabs setup on the page: tabs1 and开发者_JAVA百科 tabs2 i have this set up:

$( '#tabs1' ).tabs({
 select: function(event, ui) { 
var theSelectedTab = ui.index;

if (theSelectedTab  == 0) {
..do something
}
});

what i want to do is to add another var for the same ui.index"

$( '#tabs2' ).tabs({
 select: function(event, ui) { 
var theSelectedTab1 = ui.index;

if (theSelectedTab1  == 0) {
..do something
}
});

but it looks like var theSelectedTab = ui.index; is conflicting with var theSelectedTab1 = ui.index;

how can i separate them?

thanks


I corrected your code and you can find the complete solution here : http://jsfiddle.net/Ngetw/

I think that the error comes from a missing bracket (}) that should close the select: function(event, ui) { line.

Regards.

0

精彩评论

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