我需要弹出一段时间才能停留几秒钟。提交表单后,弹出窗口会显示,但表单的提交会重新加载页面。我想要使它看起来挂起3秒钟的功能。
这可能吗?
答案 0 :(得分:0)
试试这个:
<form action="file.html" method="POST">
<input type="text" name="testInput" id="testInputID">
<button name="submit" id="submit">
Click me!
</button>
</form>
和jQuery:
$("#submit").click(function() {
alert( "Handler for .click() called." );
});
https://jsfiddle.net/rxxpmouc/
当然,首先需要在项目中包含jQuery。
另外,如果你不喜欢jQuery,只需使用它:
<form action="" method="POST">
<input type="text" name="testInput" id="testInputID">
<button name="submit" onclick="alert('This will stay here till you press OK!');" id="submit">
Click me!
</button>
</form>