javascript - jQueryMobile alternative to $(document).ready(function() -


i have issue web app creating. have function checks if if user has input data before can use part of web application. i've been binding function page create event.

$(document).on('pagecreate', function(){                 checkopencalls();                 alert('page create event firing'); }); 

if parameters of function not input user before browsing page checkopencalls function opens dialog making user input data. issue if user accidentally browsed page , hits cancel on dialog. dialog opens again , user stuck in infinite loop.

what event load function if page called via ajax doesn't keep firing when dialog closed? i've tried pageinit , pageshow events fire everytime page shown.

edit: when browse directly page (open new tab in browser , go directly page) behavior want (the dialog closed , new 1 isn't opened) if go apps homepage , browse functions webpage behavior described in above in main post.

you using correct page event problem using every possible page , dialog (because dialog version of page).

what need bind event only page. fro example if page:

<div data-role="page" id="index">  </div> 

you use javascript execute when page created first time:

$(document).on('pagecreate', '#index',function(){     checkopencalls();     alert('page create event firing'); }); 

if take look, because page has id #index pagecreate event only bound , nothing else.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -