Jquery ui tabs "onLeave" event? -


i'm using jquery ui tabs build user interface. tabs contents loaded via ajax. i'm faced problem: when user select tab, content of previous selected tab must saved (via ajax) , don't see event "on leave current" tab (or this) trigger "save" function. edit: snipped code (how i`m build tabs):

var id_p = "a value"; $( "#dialog-confirm" ).dialog({     show: { effect: 'drop', direction: "up"},     resizable: false,     height:140,     modal: true,     buttons: {         yes: function() {             var dlg = $( );             url = "/product/edit.php?id="+id_p;             $.post(url, function(data) {                 data = $.parsejson(data);                 loadurl = data.loadurl;                 title = data.title;                 tabindex = data.tabindex;                 $("#product_tabs").tabs("add",loadurl,title);                 $("#product_tabs").tabs("select", tabindex);                 initbuttons();                 //document.location.reload();                 $( "#dialog-confirm" ).dialog( "close" );             });         },         no: function() {             $( ).dialog( "close" );         }     } }); 

i think want use activate event , ui.oldpanel save information

$("#tabs").tabs({     activate: function(event, ui) {         //do ajax stuff ui.oldpanel     }  }); 

however looks might using different version of jquery ui since version not seem have "add" or "select" method. if can confirm version using can provide better answer.

for jquery ui 1.8.16

older versions of jquery not have activate event, can kind of mimic functionality above using select event.

$("#tabs").tabs(); var previoustab = 0; //init tab selected @ start $( "#tabs" ).on( "tabsselect", function( event, ui ) {     var previouspanel = $(this).data("tabs").panels[previoustab];     //save tab info     previoustab = ui.index; //store new previous tab }); 

you can see example @ fiddle http://jsfiddle.net/pw4y6/


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -