开发者

How to open dialogs depending on what tabs are active in jQuery?

开发者 https://www.devze.com 2023-02-20 04:58 出处:网络
I have this setup, http://jsfiddle.net/patrioticcow/LQg7W/34/. How c开发者_如何学编程an the dialogs opened depending on what tabs are active?

I have this setup, http://jsfiddle.net/patrioticcow/LQg7W/34/.

How c开发者_如何学编程an the dialogs opened depending on what tabs are active?

Something is missing there..


var theSelectedTab = 0;
$( "#tabMe" ).tabs({ select: function(event, ui) { 
theSelectedTab = parseFloat(ui.index);

    }
});
    $('#edit1').click(function() {
        $('#edit_'+(theSelectedTab+1)).dialog('open');
    });
});

Tested: it worked.


You should only need to do this?

if (theSelectedTab == 0) {
    $("#edit_1").dialog("open");
} else if (theSelectedTab == 1) {
    $("#edit_2").dialog("open");
}

In the if(){} block you were assigning a live() handler but not actually triggering anything.

Adjusted jsfiddle.

0

精彩评论

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