How to prevent buttons from submitting forms

后端 未结 17 2482
礼貌的吻别
礼貌的吻别 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:16

    return false;
    

    You can return false at the end of the function or after the function call.

    Just as long as it's the last thing that happens, the form will not submit.

提交回复
热议问题