I have a textbox with ID “name”, I want to do validation when the text box get onblur function. The below code doesn’t work. What’s wrong with me?
$(function() {
$('name').validate({
rules:{ "name": {required: true, minlength: 5 } }
});
$('name').blur(function(){
$('name').validate()
});
};
Working Demo http://jsfiddle.net/qC2Ya/ or this one is way more shorter and cooler http://jsfiddle.net/XdAkv/
All you need to do is add an element validation on
blurevent and that will work like a rocket.See validation element api : http://docs.jquery.com/Plugins/Validation/Validator/element#element
Hope this helps
:)code
OR from second demo