How to prevent buttons from submitting forms

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

    The return false prevents the default behavior. but the return false breaks the bubbling of additional click events. This means if there are any other click bindings after this function gets called, those others do not Consider.

     
     
    

    Or simply you can put like this

     
    

提交回复
热议问题