Single Element Validate
Demonstrates how to validate a single required element on focus out if nothing is entered, using the jquery-validate plugin.
by harifrais
HTML
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.js"></script>
<p>Try focusing an input, then unfocus it by clicking out, or tabbing</p>
<br/>
<form>
<label for="first">First Input</label>
<input name="first" type="text" class="required" />
<br/>
<label for="second">Second Input Input</label>
<input name="second" type="text" class="required" />
</form>
JavaScript
$(document).ready(function() {
$('form').validate({
onfocusout: function(e) {
if($(e).val().length < 10 ){
console.log("true");
}else{
console.log("false");
}
}
});
});