编辑下面的代码:【加编码】
<html> <head> <link rel="stylesheet" href="https://libs.baidu.com/jquerymobile/1.4.2/jquery.mobile.min.css"> <script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script src="https://libs.baidu.com/jquerymobile/1.4.2/jquery.mobile.min.js"></script> <script> $(document).on("pageinit",function(){ alert("触发 pageinit 事件 - 页面已初始化,DOM 已加载,jQuery Mobile 已完成页面增强。") }); $(document).on("pagebeforecreate",function(){ alert("触发 pagebeforecreate 事件 - 页面即将初始化。jQuery Mobile 仍未开始增强页面。"); }); $(document).on("pagecreate",function(){ alert("触发 pagecreate 事件 - 已创建页面,但增强未完成。"); }); </script> </head> <body> <div data-role="page"> <div data-role="header"> <h1>页眉文本</h1> </div> <div data-role="content"> <p>内容...</p> </div> <div data-role="footer"> <h1>页脚文本</h1> </div> </div> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂