我有一个简单的 jquery 移动滑出对话框,第一次滑出工作正常,出现一个评论框,用户可以在其中输入评论,然后提交,然后会出现“谢谢”。
但是当用户关闭对话框并第二次滑出对话框时,“THANK YOU”仍然存在,我想生成一个新的评论框。
即使用户在没有提交的情况下在评论框中输入内容,然后返回,下一个滑出对话框仍然显示之前输入的文本!
任何帮助将不胜感激。
这是 html:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
</head>
<body>
<div data-role="page" id="pageone">
<div data-role="header">
<h1>Welcome To My Homepage</h1>
</div>
<div data-role="main" class="ui-content">
<p>Click on the link to see the slide effect.</p>
<a href="#pagetwo" data-transition="slide">Slide to Dialog Page</a>
</div>
<div data-role="footer">
<h1>Footer Text</h1>
</div>
</div>
<div data-role="page" data-dialog="true" id="pagetwo">
<div data-role="header">
<h1>Thank You!</h1>
</div>
<div data-role="main" class="ui-content">
<form action="thankyou.asp" autocomplete="on">
Comment:<input type="text" name="comment"><br>
<input type="submit" value="Submit">
</form>
<a href="#pageone">Go Back</a>
</div>
</div>
</body>
</html>
最佳答案
由于您永远不会离开页面,因此您必须使用以下方法手动重置表单:
$("#form")[0].reset();
关于javascript - jquery mobile 滑出对话框中有以前的剩余内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23963807/