html5 form validation
天蓬老师
天蓬老师 2017-07-06 10:35:42
0
2
1016

How to implement the native verification boxes in HTML5, such as required, pattern, etc., when the verification is invalid? Why does a prompt box with different content pop up when it is invalid because different constraints are not met? Is it implemented by combining the invalid event and the validity attribute? How does the setCustomValidity() method work? I feel like this content is getting more confusing the more I read it, so I would like to ask some experts for advice...

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all (2)
曾经蜡笔没有小新

Go check out the form verification on MDN. I think it’s quite clear. You can follow the small demo and you’ll understand it slowly.

    伊谢尔伦

    required: Blank verification, for example:

    If the value of input[type=text] is empty, a prompt box will pop up and form submission will be prevented;
    pattern: matches a regular expression, for example:

    If the value of input[type=text] is not 3 digits, a prompt will be raised when clicking the submit button

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!