I'm looking for a jQuery Plugin where you can enter characters separately and after you entered a character it jumps to the next character field. This kind of input is often used in connection with phone number verfication tokens. I hope you know what I mean. I also added an image of how stripe (https://stripe.com) implemented this function. Do you know any? Thanks for your help
Asked
Active
Viewed 59 times
0
-
Could you not use the .blur() and then give focus to the next field, or something like that? – Mark Handy Jun 01 '16 at 12:49
-
thanks, I just thougt there would already be some plugins (maybe although with some design) out there – Maximilian Stölzle Jun 01 '16 at 12:50
-
1google gave me this: http://stackoverflow.com/questions/10539113/focusing-on-next-input-jquery – Mark Handy Jun 01 '16 at 12:51
-
This may help too. https://forum.jquery.com/topic/how-to-auto-focus-on-next-text-input-textbox Just need to work out the logic on moving to the next field. May want to consider some validation too. – Mark Handy Jun 01 '16 at 12:53
1 Answers
1
Here is a very simple example, a plugin is not needed: https://jsfiddle.net/yomtym8L/
Jquery:
$(document).ready(function() {
$("input").on("keypress", function() {
$(this).next().focus();
})
})
On key press of one input, focus its next sibling
HTML:
<input type="text">
<input type="text">
<input type="text">
<input type="text">

theblindprophet
- 7,767
- 5
- 37
- 55