javascript - jquery 移动弹出对话框 : Cannot read property 'is' of undefined

标签 javascript jquery html css jquery-mobile

我正在尝试使用 jquery 打开对话框。我已使用链接遵循说明:http://demos.jquerymobile.com/1.2.0/docs/pages/popup/index.html

代码如下: 对话框

    <div data-role="popup" id="popupDialog" data-overlay-theme="a" data-theme="c" style="max-width:400px;" class="ui-corner-all">
        <div data-role="header" data-theme="a" class="ui-corner-top">
            <h1>Delete Page?</h1>
        </div>
        <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content">
            <h3 class="ui-title">Are you sure you want to delete this page?</h3>
            <p>This action cannot be undone.</p>
            <a href="#" data-role="button" data-inline="true" data-rel="back" data-theme="c">Cancel</a>
            <a href="#" data-role="button" data-inline="true" data-rel="back" data-transition="flow" data-theme="b">Delete</a>
        </div>
    </div>

关于 jquery ready 函数,尝试通过代码打开它: $("#popupDialog").popup(); $("#popupDialog").popup("打开");

getting error

不确定哪里出了问题,找不到任何帮助!!!

最佳答案

在 jQM pageshow 事件而不是 jQuery 就绪事件上打开弹出窗口:

API:http://api.jquerymobile.com/1.3/pageshow/

$(document).on("pageshow","#page1", function(){ 
  $("#popupDialog").popup("open");
});  

DEMO

关于javascript - jquery 移动弹出对话框 : Cannot read property 'is' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41984799/

相关文章:

javascript - ajax 从成功的 View 中删除 div

javascript - 在 Javascript/Jquery 中对对象数组进行子集化和编辑

javascript - jQuery:动画宽度/高度,但保持居中

javascript - 从字符串中提取小数

javascript - JQuery UI 自动完成立即消失

java - 无法从对 servlet 的 ajax 调用中检索 session 属性

javascript - jQuery/JavaScript : tidy html

html - CSS | Navigationlinks 填充问题

javascript - 如何在 Javascript 中解析 UserAgent

javascript - 输入代码后,我收到一个错误,显示 "not called in your program",并且错误显示 btn 是预期的 token