How to prevent buttons from submitting forms

后端 未结 17 2145
礼貌的吻别
礼貌的吻别 2020-11-21 04:43

In the following page, with Firefox the remove button submits the form, but the add button does not.

How do I prevent the remove button from submitting t

17条回答
  •  忘掉有多难
    2020-11-21 05:33

    $("form").submit(function () { return false; }); that will prevent the button from submitting or you can just change the button type to "button" instead of Which will only work if this button isn't the only button in this form.

提交回复
热议问题