Tuesday, 7 June 2016

jquery validation examples :Hemant Vishwakarma

HTML

<form> 
    <input name="test" /> 
   <input type="submit" value="Submit">
</form>

JS

$("form").validate({
    errorClass: "my-error-class",
    validClass: "my-valid-class",
    rules: {
            test: {
                required: true,
                minlength: 12
            }
    }
});

CSS
.my-error-class {
    color:red;
}
.my-valid-class {
    color:green;
}

No comments:

Post a Comment