When I was writing data validation, I forgot to write the new custom validation in dwz. Just find dwz. min. if ($. validator) {location, write your own regular expression validation in it. I have added two regular expressions. The Mac or MMS code is as follows:
If ($. validator) {$. validator. addmethod ("Alphanumeric", function (value, element) {return this. optional (element) |/^ \ W + $/I. test (value) ;}, "letters, numbers or underscores only please"); $. validator. addmethod ("lettersonly", function (value, element) {return this. optional (element) |/^ [A-Z] + $/I. test (value) ;}, "letters only please"); $. validator. addmethod ("phone", function (value, element) {return this. optional (element) |/^ [0-9 \ (\)] {7, 30} $ /. test (value) ;}, "Please specify a valid phone number"); $. validator. addmethod ("Mac", function (value, element) {return this. optional (element) |/^ ([a-fA-F0-9] {2}: [a-fA-F0-9] {2}: [a-fA-F0-9] {2}: [a-fA-F0-9] {2 }: [a-fA-F0-9] {2}: [a-fA-F0-9] {2 }) | ([a-fA-F0-9] {2}-[a-fA-F0-9] {2}-[a-fA-F0-9] {2}-[a-fA-F0-9] {2}-[a-fA-F0-9] {2}-[a-fA-F0-9] {2 }) $ /. test (value) ;}, "Please specify a valid phone number"); $. validator. addmethod ("MMS", function (value, element) {return this. optional (element) |/^ MMS $ /. test (value) ;}, "Please MMS ");
Add class = "MMS" or class = "Mac" to the HTML tag to be used.
The Code is as follows:
<input type="text" name="aaa" class="required mac"/>
The first class is non-empty, and the second is self-written validation.
Added custom validation rules for dwz Data Validation