views:

38

answers:

1

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 select 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?

A: 
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');

}
Haroldis
I don't really follow this.
fearofawhackplanet
When you declare the tab on jsin show property declare the function to call
Haroldis
ah ok, i see what you're doing now. This doesn't work though, it doesn't answer the problem in the question. `Show` is not fired when you click on the already open tab.
fearofawhackplanet