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

Export To Excel Even With Special Character in Data

Get Plain Text from FCKEditor in any Browser.