jQuery Mobile pageinit/pagecreate not firing

后端 未结 7 1921
栀梦
栀梦 2020-12-05 05:24

I have 5 pages - for ease lets say:

  • one.html
  • two.html
  • three.html
  • four.html
  • five.html

When I load each indivi

7条回答
  •  星月不相逢
    2020-12-05 06:00

    If you want to call some function each time before loading a page then you can use pagebeforeshow i.e.

      $("#YourPageID").on('pagebeforeshow ', function() {
            //YourFunctionCall();
        });
    

    as well as you can try binding your pageinit with page id but page init is called only once while inserting your page in DOM. http://jquerymobile.com/test/docs/api/events.html

      $("#YourPageID").on('pageinit', function() {
            //YourFunctionCall();
        });
    

提交回复
热议问题