gpt4 book ai didi

jquery-mobile - 使用 mobile.changepage 的 Jquerymobile 对话框在第二页上不起作用

转载 作者:行者123 更新时间:2023-12-01 12:57:35 25 4
gpt4 key购买 nike

我有一个对话框(不是外部 html),当我单击页面上的按钮时会显示它,如果包含对话框的 html 是要访问的第一个页面,它工作正常,但如果该文件是由单击另一个页面的 href,当我单击该按钮时对话框不显示。

这是包含对话框的页面的代码...即使这不是要访问的第一个页面,按钮的单击事件中的警报也会显示,但对话框不会显示。

<!DOCTYPE html>
<html>
<head>
<title>Create Team</title>
<link rel="stylesheet"
href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>

</head>
<body>

<!-- Page starts here -->
<div data-role="page" data-theme="b" id="page1">
<div data-role="header" id="hdrMain" name="hdrMain"
data-nobackbtn="true">
<h1>Test screen</h1>
</div>
<div data-role="content" id="contentMain" name="contentMain">
<div id="fullnamediv" data-role="fieldcontain">
<label for="fullname" id="fullnameLabel" name="fullnameLabel">Team
Name*</label> <input id="fullname" name="fullname_r" type="text" />
</div>
<div id="submitDiv" data-role="fieldcontain">
<a id="buttonSave" name="buttonSave" href="#" data-role="button"
data-inline="true">Save</a>
</div>
</div>
<!-- contentMain -->
<div data-role="footer" id="ftrMain" name="ftrMain"></div>
<script>
$("#page1").bind("pagecreate", function() {
$('#buttonSave').click(function() {
alert("aaaa");
$.mobile.changePage('#successdiv', {
transition: 'pop',
reverse: false,
changeHash: true
});
alert("after change");
return true;
});
});
</script>

</div>
<!-- page1 -->

<div data-role="dialog" data-theme="a" id="successdiv">
<div data-role="header" data-theme="f">
<h1>Error</h1>
</div>
<div data-role="content">
<p>This is Page 2</p>
<button type="submit" data-theme="e" name="successok"
value="submit-value" id="successbutton">Close Dialog</button>
</div>
</div>
<!-- Page ends here -->
</body>

</html>

最佳答案

您使用 jQuery Mobile v1.0,但同时您向 $.mobile.changePage 传递了不正确的参数,就好像它是 v1.0 alpha 版一样。不确定它是否能解决您的问题但值得一试:

$.mobile.changePage('#successdiv', {
transition: 'pop',
reverse: false,
changeHash: true
});

关于jquery-mobile - 使用 mobile.changepage 的 Jquerymobile 对话框在第二页上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8860624/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com