开发者

jQuery tabs, dynamically binding to click event on currently selected tab

开发者 https://www.devze.com 2023-01-14 03:15 出处:网络
I\'m trying to bind to the click event of the currently selected tab with jQuery tabs. I\'m dynamically creating tabs so I need to do live binding. The idea is that I want to reload the current tab if

I'm trying to bind to the click event of the currently selected tab with jQuery tabs. I'm dynamically creating tabs so I need to do live binding. The idea is that I want to reload the current tab if it's clicked on again.

I tried binding in the sele开发者_JS百科ct event, but it seems this event doesn't fire for click on the already selected tab.

I also tried a standard jQuery live binding:

$('li.ui-tabs-selected').live('click', function() {
    alert('woof');
});

this doesn't seem to work either, but I can't work out why not. I can only guess the tab framework is intercepting the click event.

Any ideas?


jQuery(document).ready(function() {

    jQuery(".ui-layout-center").tabs({
        show: loadTab
    });

    rootLayout = jQuery('#container').layout
           ({
               applyDefaultStyles: true,
               north__spacing_open: 0
           });

    jQuery("#tabs_div").tabs();
    loadIframe();
});

function loadTab()
{
 alert('woof');

}
0

精彩评论

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