views:

21

answers:

1

Is there any initialize event in Jquery UI Tabs , which executes only once when particular tab loads ?

As show function in Jquery UI tabs executes every time when tab gets load , i want an event that executes only once..

+1  A: 

So set some global variable to true and next time the event fires ignore it.

var already_loaded = false;
$('#example').tabs({
    load: function() {
        if(already_loaded) {
            return
        }
        already_loaded = true;
        //stuff happens here
    }
});

A cleaner way would be not to use a "global" variable but to use data() to set properties.

nc3b
for each tab i have to set a global variable , so is there any direct way ?
hunt