Phone Number Auto Increment Decrement Focus

Following Jquery functions are used to set focus on text box on max length and set focus to prev text box on click of backspace when length gets zero.



$(function () {
$('.phoneText,.AlternatePhoneText,.FaxText').keyup(function (e) {
if (e.which == 8) {
if ($(this).val().length == 0)
 $(this).prev(':input').focus();

}
else {

if ($(this).val().length == $(this).attr('maxlength'))
 $(this).next(':input').focus();

}
})
})


 

Comments

Popular posts from this blog

Chanakya's Quotes - Worth reading a million times…

Why the Elephants Don't Run?