Monday 15 August 2011

javascript - jqueryui Tabs + onunload -


I have a jqueryui tab on a page, when clicking on the "tabs" link, different & lt; Section & gt; / Code> Elements around my page, in other words, all my content is on a page (a file).

The problem I have is a & lt; Section & gt; If you do one of the or "tabs", then I have to make sure that any user submits all fields / forms before leaving this field, it is a Multi-Part Multi -Age Request Request . In this way, if the user has filled up everything, then it is okay. He could leave later.

However, if the user starts to submit the form but does not complete, and tries to click on any other tab, then I should have a popup such as "On the page , "Leave page" .

In the DOM, I believe a onunload hook that I can use , But I do not know how to do this in jqueryui tabs . Any hook which I could use with the plugin

My jqueryui tabs code:

  $ (function () {$ ("#tabs") .tabs ();})   

My html structure:

navigation:

  
    Lt; li & gt; & lt; a href = "# tab-1" & gt; first & lt; / a & gt; & lt; / li & gt;
  • & lt; a href = "# Tab2" & gt; Second & lt; / a & gt; & lt; / li & gt;
  • & lt; a href = "# Tabs-3" & gt; Third & Lt; / a & gt;
  • I think you use something like this incident to get it can do.

      $ (function () {$ ("# tabs"). Tabs ({First Activate: Function (e, UI) {if (ui.oldTab.attr ('id') == 'Tab-1') {If (Confirm ('do you want to leave?')) {Return false}}}});});    

No comments:

Post a Comment