I'm not very experienced at javascript or jquery. I need to figure out whether the user's cursor is in the last position of a text input field with a maxlength of 3 on key up. If so, switch focus to the next field. I've seen this done a lot on forms so I think everyone can understand the semi common functionality I'm looking for. The input fields in question are not of type text, but of type tel
I tried to find an answer to this question here, but I couldn't understand any of the answers to what might be a similar question that I'm asking, but not exactly the same. For example, it mentions selectionStart and selectionEnd but I can't find where these are really explained. It seems to me like they involve selected text, but that's not what I want.
I want this to be checked while the user is typing. Here's what I have tried just to see if I can get a correct value back, but it returns undefined.
$("#phone1").keyup(function(){
var phone = $("#phone1");
alert(phone.selectionEnd);
});
Sorry if I don't understand some of this. Any assistance would be greatly appreciated. Thanks.