ivoilic Posted March 31, 2012 Share Posted March 31, 2012 So I have code for three text-boxes in a form: <input type='text' name='serial1' style="width:40px;" maxlength="4"> - <input type='text' name='serial2' style="width:40px;" maxlength="4"> - <input type='text' name='serial3' style="width:40px;" maxlength="4"> What I want to know is if there is anyway to make it so that after the user has typed the max # of characters in the first text box the cursor will automatically move to the next text-box. Link to comment https://forums.phpfreaks.com/topic/260090-continue-typing-in-next-text-box/ Share on other sites More sharing options...
requinix Posted March 31, 2012 Share Posted March 31, 2012 Sure. Stick an onkeypress in each one that moves focus() to the next one if the value.length == maxlength. Link to comment https://forums.phpfreaks.com/topic/260090-continue-typing-in-next-text-box/#findComment-1333079 Share on other sites More sharing options...
ivoilic Posted March 31, 2012 Author Share Posted March 31, 2012 Sorry for being a noob but I just tried to figure out how to do that and completely failed. Would you please clarify? Link to comment https://forums.phpfreaks.com/topic/260090-continue-typing-in-next-text-box/#findComment-1333101 Share on other sites More sharing options...
requinix Posted March 31, 2012 Share Posted March 31, 2012 Untested. function moveserial(self, to) { if (self.value.length == self.maxlength) { self.form[to].focus(); } } - - Link to comment https://forums.phpfreaks.com/topic/260090-continue-typing-in-next-text-box/#findComment-1333109 Share on other sites More sharing options...
ivoilic Posted April 1, 2012 Author Share Posted April 1, 2012 I tried your script and it did not work however I found this plug-in: http://www.mathachew.com/sandbox/jquery-autotab/ So I ended up getting what I needed and some. Thanks for all your help. Link to comment https://forums.phpfreaks.com/topic/260090-continue-typing-in-next-text-box/#findComment-1333133 Share on other sites More sharing options...
UrbanDweller Posted April 1, 2012 Share Posted April 1, 2012 Cool script to bad i dont know jquery. sure its not hard without it though Link to comment https://forums.phpfreaks.com/topic/260090-continue-typing-in-next-text-box/#findComment-1333179 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.