HTML5 validation when the input type is not “submit”

后端 未结 9 1347
醉酒成梦
醉酒成梦 2020-11-29 01:42

I\'m using HTML5 for validating fields. I\'m submitting the form using JavaScript on a button click. But the HTML5 validation doesn\'t work. It works only when then input ty

9条回答
  •  生来不讨喜
    2020-11-29 01:53

    Either you can change the button type to submit

    
    

    Or you can hide the submit button, keep another button with type="button" and have click event for that button

提交回复
热议问题