我想要这样,如果人们点击发送按钮,那么应该停止表单的提交。
我的目标是提交消息,但让用户保持在同一页面上。
我的 JS:
$(document).ready(function () {
$("#kontakt").submit(function () {
return false;
});
HTML:
<form id="kontakt" method="post" action="send.php">
<br>
<input type="text" name="von" id="von" placeholder="name" />
<br>
<input type="text" id="mail" name="mail" placeholder="email" />
<br>
<input type="text" id="betreff" id="betreff " placeholder="betreff" />
<br>
<textarea style="width:500px;height:400px;" id="nachricht" name="nachricht"></textarea>
<input id="submit" type="submit" value="senden"></input>
</form>
<div id? "response"></div>
小提琴:http: //jsfiddle.net/gF6wg/
问题是,如果您单击“发送”,表单仍在提交中。