JQuery Mobile:根据条件防止更改页面
我希望防止基于条件(计算或服务调用的结果)的页面更改 我已经阅读了以下链接,但在iOS设备(混合应用程序)上没有任何东西适合我 我的HTML看起来像:JQuery Mobile:根据条件防止更改页面,jquery,jquery-mobile,Jquery,Jquery Mobile,我希望防止基于条件(计算或服务调用的结果)的页面更改 我已经阅读了以下链接,但在iOS设备(混合应用程序)上没有任何东西适合我 我的HTML看起来像: <ul data-role="listview" data-inset="true"> <li><a href="#secondPage" Onclick='change(0)' id='secBtn'>Second Page</a></li> &l
<ul data-role="listview" data-inset="true">
<li><a href="#secondPage" Onclick='change(0)' id='secBtn'>Second Page</a></li>
<li><a href="#thirdPage" Onclick='change(1)' id='thrBtn'>Third Page</a></li>
</ul>
现在,当调用e.preventDefault()时,它会停止所有按钮、链接等上的所有事件
我只想在特定按钮、LI或项目上停止/运行。我不知道如何做到这一点
有什么建议吗
function change(val) {
if(val == 1) {
$.mobile.changePage("#thirdPage", { transition: "slide"});
}else {
$(document).bind("pagebeforechange", function(e ,ob) {
if(ob.toPage && (typeof ob.toPage==="string") && ob.toPage.indexOf('page.html') >= 0) {
e.preventDefault();
e.stopPropagation();
$.mobile.activePage.find('.ui-btn-active').removeClass('ui-btn-active');
}
});
}
}