Text boxes are validated using key up and blur functions, Key up event occurs on every character type but blur function is different from key up. Blur event occurs when pointer comes out of text box.
Here is some jQuery code that validates text boxes.
Name and owner are two text boxes that are validated in a way that only character values are allowed in text boxes.
text boxes have only string not numbers.

$(‘#name’).bind(‘keyup blur’,function(){
$(this).val( $(this).val().replace(/[^a-zA-Zs]/g,”) ); }
);     

    $(‘#owner’).bind(‘keyup blur’,function(){
$(this).val( $(this).val().replace(/[^a-zA-Zs]/g,”) ); }
);

 

Leave a Reply

Your email address will not be published. Required fields are marked *