我是按照jQuery Mobile官方文档的介绍看的:
Important: Use pageInit(), not $(document).ready()
但是,当我写的时候:
pageInit(function()
alert('ahhh');
});
我的 Safari 控制台告诉我:Cant find variable "pageInit"
这是为什么?如何使用函数 pageInit()
?
最佳答案
$( '#aboutPage' ).live( 'pageinit',function(event){
alert( 'haa!' );
});
或使用 JQuery 1.7
$("#myPage").on('pageinit', function(event){
alert('haa');
});
顺便说一下,在 JQMobile 中它推荐使用 Jquery 1.6.4,因此,第一个例子是正确的。
ZY
关于javascript - jQueryMobile pageInit, "Can' t 找到变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8172364/