H5 form verification failed how to prompt

This article mainly introduces how H5 form verification failed to prompt, with a certain reference value, and friends who need it can refer to it. I hope that everyone has a big gain after reading this article. Let’s take a look at you with everyone.

We know that the front-end children’s shoes are in writing, and they will always step on the form to verify this pit. At this time, we have to kneel, because we must write a bunch of JS to check. But since After H5 appears, many common expression verification, it has helped us to achieve, let us alleviate a lot of burden, it seems to be below:

Email address verification:

    TEST     Mailbox:        The mailbox verification is H5 itself, but what we have to verify is a variety of scenes, what should I do? Use back JS? Very obvious Such an egg hurts, because H5 provides Pattern attributes, let us self-sufficient! We can specify regular expressions in Pattern, as long as the right is written, it is not worried!   Regulations limit 11 digits: 


  Number:         Question   There is a problem, we have to solve it, and we will have a long time for Google, and finally have a good party:   onInvalid : When the value of the INPUT element is invalid (here is the regular verification failed), the   OnventID event is triggered. OnInvalid belongs to the FORM event.  
setcustomvalidity (): This is an HTML5 built-in JS method, with the definition prompt information

, it can be used to define prompts with OnInvalid and SetCustomValidity, then this is good, modify the source code as follows :



“Format” finally is not the egg pain, now the form verification prompt is clearly told us that here should What kind of data is entered so that users can better modify their own input!
  Thank you to read this article carefully, I hope that Xiaobian share H5 form verification failed how to prompt content Everyone has help, and I hope everyone will support Tumi Clouds, pay attention to Tumi CloudIndustry information channel, I will find TUMI clouds in trouble, detailed solutions are waiting for you!                      
© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment