【发布时间】:2012-07-08 16:22:01
【问题描述】:
在我的 jQuery Mobile 中,我有 2 个页面,index.html 和 test.html。索引页面中有一个<p>标签,它有一个类,所以当我的javascript点击<p>标签时,它想加载test.html。
但是使用 jQuery Mobile 时,索引页面加载测试页面时,它不在 DOM 中。因此,为了进入测试页面并替换 test.html 中 div 的内容,必须首先将其加载到 DOM 中。所以这就是我正在做的事情:
当点击 try2 时,我执行加载页面以将其放入 DOM,然后将 div 替换为新的 html,然后切换到页面。 div 的 html 永远不会改变。
$('.try2')
.click(function(){
$.mobile.loadPage( 'test.html', { showLoadMsg: false } );
$('#mytest').html('i am here now').fadeIn('slow');
$.mobile.changePage( "test.html", { transition: "slideup"} );
});
【问题讨论】:
标签: jquery-mobile