jQuery   发布时间:2022-04-19  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了创建一个对话框JQuery Mobile大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图用Jquery mobile创建一个对话框.我试图参接受的答案 in this SO question,但对我来说并不奏效.

这是我的代码

<div data-role="page" id="first"> 
    <!-- Code -->  
    <div id = "dialog" data-rel="dialog">
        <div id = "errorText"></div>
        <button id = "closeDialog">OK</button>
    </div>
</div>

这里是JS做出的(在一个函数内):

//Nothing checked. CAnnot conTinue. Add error message to div
$('#errorText').html("You must check the checkBox next to \"I Agree\" to conTinue");
//Open Dialog
$('#dialog').dialog();

当创建对话框的代码没有发生什么.建议?

解决方法

对话框应该是一个单独的页面div,您可以通过Ajax加载或包含在HTML中.这是一个例子.
<!DOCTYPE html>
<html>
    <head>
    <title>Page title</title>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
</head>
<body>
<div data-role="page">
    <div data-role="header">
        <h1>Sample</h1>
    </div>
    <div data-role="content">
        <p></p>
        <p><a href="dialog.html" data-rel="dialog" data-role="button">Is this a question?</a></p>
    </div>
</div>
<div data-role="page" data-url="dialog.html">
    <div data-role="header">
        <h1>Dialog</h1>
    </div>
    <div data-role="content">
        <p>Is this an answer?</p>
    </div>
</div>
</body>
</html>

大佬总结

以上是大佬教程为你收集整理的创建一个对话框JQuery Mobile全部内容,希望文章能够帮你解决创建一个对话框JQuery Mobile所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。