Friday, January 1, 2016

validation tip and trick using JQuery or javascript

<input   name="email"   validation="required"   validate="email"   minLength="7"   maxLength="30"/> 
Use metadata instead:

<input   name="email"   class="validation {validate: email, minLength: 2, maxLength: 50}" />

<script>
    jQuery('*[class=validation]').each(function () {
        var metadata = $(this).metadata();
        // etc.
    });
</script>

No comments:

Post a Comment