我有一個單一的HTML頁面,其中我使用兩個是data-role =「page」,另一個是data-role =「dialog」。 在我的頁面的div我有一個按鈕,該按鈕的點擊我想叫格dialog.here是我的榜樣---無法調用數據角色=「對話框」
<html>
<body>
<div data-role="page"
data-add-back-btn="true" data-theme="d">
<div data-role="fieldcontain" align="vertical">
<input type="reset" data-role="button" value="ok"
id="okButton">
</div>
$("#okButton").click(function()
{
$.mobile.changePage("#myDialog");
});
</div>
<div id="myDialog" data-role="dialog" data-theme="b" >
<div data-role="content">
<div data-role="controlgroup" data-type="vertical">
<input type="submit" data-role="button" value="Add Margin" id="addmargin">
<input type="submit" data-role="button" value="CTD" id="ctd">
<input type="submit" data-role="button" value="Square Off" id="squareoff">
<input type="submit" data-role="button" value="Change Sqr.Off Mode" id="changeSqrMode">
</div>
</div>
上面的代碼工作正常,但如果我要打電話點擊表格中的對話框就不會調用它。這裏是我的錶行點擊:
<script type="text/javascript">
$("#tableId tr td").live("click",function(e)
{
var newrow = $(this).parent().parent().children().index($(this).parent());
e.stopImmediatePropagation();
alert("after e.stopImmediatePropagation");
alert("Before myDialog");
$.mobile.changePage('#myDialog');
});
</script>
這裏myDialog警報顯示,但$ .mobile.changePage( '#myDialog')之前;未執行,或myDialog不顯示。
任何建議將不勝感激。提前致謝。
嗨你的jQM版本..? –
@ArjunTRaj它的1.1.1 – PPD