Can I make a <button> not submit a form?

前端 未结 8 1365
耶瑟儿~
耶瑟儿~ 2020-11-22 05:36

I\'ve got a form, with 2 buttons



8条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 06:05

    Without setting the type attribute, you could also return false from your OnClick handler, and declare the onclick attribute as onclick="return onBtnClick(event)".

提交回复
热议问题