JQuery Mobile : Prevent changePage based on condition -


i want prevent page change based on condition (result of calculation or service call).

i have read below links nothing works me on ios device (hybrid app).

http://www.raymondcamden.com/index.cfm/2012/7/19/preventing-navigation-to-a-page-in-jquery-mobile stop active ajax requests in jquery http://jsfiddle.net/kiliman/zmnum/

my html looks like:

<ul data-role="listview" data-inset="true">          <li><a href="#secondpage" onclick='change(0)' id='secbtn'>second page</a></li>         <li><a href="#thirdpage" onclick='change(1)' id='thrbtn'>third page</a></li>  </ul> 

and in js , want achieve similar:

function change(val) { if(val == 1) {     $.mobile.changepage("#thirdpage", { transition: "slide"}); }else {     $(document).bind("pagebeforechange", function(e ,ob) { if(ob.topage && (typeof ob.topage==="string") && ob.topage.indexof('page.html') >=   0) {     e.preventdefault();     e.stoppropagation();                  $.mobile.activepage.find('.ui-btn-active').removeclass('ui-btn-active');       }     });  }  } 

now when e.preventdefault() has been called stops events on buttons, links etc.

i want stop/run on particular button, li or item. don't know how achieve this.

any suggestions please.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -