Trigger standard HTML5 validation (form) without using submit button?

前端 未结 12 1439
攒了一身酷
攒了一身酷 2020-11-28 07:07

Anyone who know how I can trigger the standard HTML5 validation in a form without using a submit button? (JavaScript or jQuery).

I do not want to se

12条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 07:40

    The accepted answer to this question appears to be what you're looking for.

    Short summary: in the event handler for the submit, call event.preventDefault().

提交回复
热议问题