Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery - on key up go to next input field
    text
    copied!<p>I'm currently busy with 13 input fields that's results get merged into a variable, I have to split it into 13 for I need to add a block effect such as you will find on many forms in the real world. the limit to each block is one, I need to find away so that when you insert a digit, it goes to the next field until all fields have been filled then a validation function will fire off.</p> <p>Heres the html:</p> <pre><code>&lt;div id="error"&gt;&lt;/div&gt; &lt;form id="idCheck"&gt; &lt;input class="id" id="idnumber1" maxlength="1" /&gt; &lt;input class="id" id="idnumber2" maxlength="1" /&gt; &lt;input class="id" id="idnumber3" maxlength="1" /&gt; &lt;input class="id" id="idnumber4" maxlength="1" /&gt; &lt;input class="id" id="idnumber5" maxlength="1" /&gt; &lt;input class="id" id="idnumber6" maxlength="1" /&gt; &lt;input class="id" id="idnumber7" maxlength="1" /&gt; &lt;input class="id" id="idnumber8" maxlength="1" /&gt; &lt;input class="id" id="idnumber9" maxlength="1" /&gt; &lt;input class="id" id="idnumber10" maxlength="1" /&gt; &lt;input class="id" id="idnumber11" maxlength="1" /&gt; &lt;input class="id" id="idnumber12" maxlength="1" /&gt; &lt;input class="id" id="idnumber13" maxlength="1" /&gt;&lt;span id="status"&gt;&lt;/span&gt; &lt;p&gt; &lt;input type="submit" id="check" value="Check" /&gt; &lt;/p&gt; &lt;/form&gt; &lt;div id="result"&gt; &lt;/div&gt; </code></pre> <p>and heres the javascript:</p> <pre><code>function Validate() { jQuery('#error p').remove(); var error = jQuery('#error'); var p1 = jQuery('#idnumber1').val(); var p2 = jQuery('#idnumber2').val(); var p3 = jQuery('#idnumber3').val(); var p4 = jQuery('#idnumber4').val(); var p5 = jQuery('#idnumber5').val(); var p6 = jQuery('#idnumber6').val(); var p7 = jQuery('#idnumber7').val(); var p8 = jQuery('#idnumber8').val(); var p9 = jQuery('#idnumber9').val(); var p10 = jQuery('#idnumber10').val(); var p11 = jQuery('#idnumber11').val(); var p12 = jQuery('#idnumber12').val(); var p13 = jQuery('#idnumber13').val(); var idNumber = p1 + p2 + p3 + p4 + p5 + p6 +p7 + p8 + p9 + p10 + p11 + p12 + p13; }; </code></pre> <p>any help greatly appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload