google chrome submits form even if there is no SUBMIT button

后端 未结 3 1155
醉话见心
醉话见心 2021-01-13 01:59

This bug/feature cropped up in one of my pages when viewed in google chrome so i wrote a test page which looks like this


 

        
3条回答
  •  一生所求
    2021-01-13 02:26

    To cite section 4.10.21.2 of the HTML5 specification:

    "If the form has no submit button, then the implicit submission mechanism must just submit the form element from the form element itself."the form element itself."

    Therefore I believe Chrome's behaviour to be correct, although I think other browsers do this as well. You can catch/block/process form submission by listening to the "submit" (e.g. to block it) event.BlockquoteBlockquotethe form element itself."

提交回复
热议问题