Unwritten type=button on the button causes it to be submitted when clicked

  • 2020-03-30 02:14:41
  • OfStack

There is a place very strange: click a popover button, did not think of popover disappeared, after the company's js master debugging, found the mystery
 
<button class="btn btn_set_wj" onclick="add_q()"> Add questionnaire </button> 

Just add a type ="button" :
 
<button class="btn btn_set_wj" type ="button" onclick="add_q()"> Add questionnaire </button> 

Different browsers support different rules

Related articles: