how to use pageInit()?
in jQuery Mobile
•
11 years ago
Hi
The docs say very prominently not to use "$(document).ready()" any more but to use "pageInit()" instead.
So I am trying to change to pageInit() and also change from "window.open" to "pageChange".
I understand that to do this all pages should have the same header that references all the sources needed by any of the pages.
And I understand the page specific code has to be in the <div data-role="page"> element.
So far hopefully so good.
Here is my problem: What is the correct call for pageInit? I have tried all of these:
- $(document).ready(function(){
- $(document).delegate("#FeldEditPage", "pagecreate", function() {
- $(document).delegate("#FeldEditPage", "pagebeforecreate", function() {
- $(document).bind("pageInit", function(){
- $("#FeldEditPage").bind("pageInit", function(){
- jQuery("div:jqmData(role='page'):last").bind('pageInit', function() {
- plus variations using live instead of bind.
The first three work only on the first document - not after changePage was executed. They work perfectly when I use window.open istead of changePage.
With the others no code is executed at all.
Thanks in advance for help!
Alex
1