JQuery Focus, after blur
JQuery Focus, after blur
I have two form elements, the first one I'm testing for a specific content length (5). If there is not that much content in the box, I would like it to continue to have focus.
However my code below will not set the focus back.. What am I missing?
- jQuery( function($){
$(document).ready( function(){
$("#Transit_Number").blur( function(e){
if ( $(this).val().length != 5 ){
e.stopPropagation();
e.preventDefault();
$("#Transit_Number").focus();
alert('Transit Number Must be 5 digits long');
}
});
});
});