Try this, it will work
function phoneNumberValidate(phone1,match_len,phone2)
{
//called when key is pressed in textbox
$("#"+phone1).keypress(function (e)
{
var entered_key = String.fromCharCode(e.which);
//if the letter is not digit then display error and don't type anything
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57))
{
return false;
}
else
{
var phone=$("#"+phone1).val();
var field_len=phone.length;
if(field_len==match_len && e.which != 8 )
{
$("#"+phone2).focus().val(entered_key);
}
}
});
}