jquery ui tabs need to empty the previous tab when we move to next tab -


I have just created a script to clear the selected tab. When we switch from 1 to 2 to 3 then it is working fine.

But when we switch from 3 to 2 to 1 then it is not working. Here is the script

  var prevTab = 0; JQuery ("# ​​tab") tab ({fx: {opacity: "toggle"}, cache: wrong, show: function (Event, UI) {Warning (prevTab); var prevTab = ui.index; jQuery (" # Ui-tabs - "+ prevTab) .empty (); // sets the new previous tab index in the current index}});  

Since I have a form in each tab, I got a conflict, so I need to clear the contents of the previous tab.

Thank you for your help, Gobi:

inside the callback function Creating a new local variable var prevTab = Ui.index . In this way, when you exit the function (and its scope), the value is lost instead of declaring a new instance, use existing prevTab and it should be correct

  var prevTab = 0; JQuery ("#tab"). Tab ({fx: {opacity: "toggle"}, cache: incorrect, show: function (Event, UI) {Warning (prevTab); prevTab = ui.index; // var var ("# Ui-tabs -" + PrevTab) .empty ();}});  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -