It's a good feeling to see the sharp jquery these days. Especially jquery's powerful selector. Use jquery today to write a small case of your own form verification. While consolidating the next jquery. First, the code, of course, is only a small case.
Ideas:
1, <input type= "text" validate= "date" id= "date"/> Here Validate: is we need to verify the type (belongs to the date type), here you can also define yourself. The id attribute is needless to say. <input type= "text" validate= "Notstringnull" id= "notstring"/>
2. var arrayinput = jQuery (' #FormData input ');//Gets the input tag from the form so that all the input tags under the form form can be found
3, iterate array, get Validate property value, see if need to verify, here I use case match
4, using regular expressions to judge or other parties to verify the value of the change is legitimate
5. Use array to store the result and the ID of the corresponding element
6, traversal array, if the value is judged false, then the corresponding color set corresponding to the color of the CSS value, prompting the user.
7. Return the result of validation
<! DOCTYPE html>Verify that the result is false
Verify that the result is false
Verify that the result is true
Use jquery to write your form validation