本文介绍了jquery提交表单中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



I tried stop form refreshing the page but it refreshes page every time i submit the form.

<script>
$("#myforms").submit(function() {

   return false;
});
</script>

<form action="" method="post" id="myforms">
      <input id="search123" style="text-align:center" type="text" value="Enter Search..." />
    </form>

更新:

Update:

$(document).ready(function() {
    $("#myforms").submit(function() {
              runSearch123();
              return false;
        });
});

同样的问题

Still same problem

推荐答案

您需要将代码放入jQuery 中。

You need to put your code in the jQuery ready handler.

<script>
$(function(){
  $("#myforms").submit(function() {
              return false;
        });
});
</script>

这篇关于jquery提交表单中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 22:25
查看更多