title: Return to the previous Input Javascript
body: <p>When the numbers are typed, they automatically go to the next input. But how do I get it back to the previous input when I delete it from the input?</p>
  
  <p><a href="https://jsfiddle.net/emresaracoglu/0tdp9mzj/" rel="nofollow noreferrer">JSfiddle</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>(function() {
    var inputs = $("#passForm input");
    inputs.each(function(i, item) {
      $(item).keyup(function() {
        if ($(this).val().length == $(this).attr('maxlength') &amp;&amp; inputs[i + 1]) {
          if (inputs[i + 1]) {
            inputs[i + 1].focus();
          }
        }
      });
    });
  }());</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;form action="" role="form" method="post" id="passForm"&gt;
    &lt;input type="text" class="passInput" autofocus name="pass[]" maxLength="1" autocomplete="off" size="1" min="0" max="9" required pattern="[0-9]{1}" /&gt;
    &lt;input type="text" class="passInput" name="pass[]" maxLength="1" size="1" autocomplete="off" min="0" max="9" required pattern="[0-9]{1}" /&gt;
    &lt;input type="text" class="passInput" name="pass[]" maxLength="1" size="1" autocomplete="off" min="0" max="9" required pattern="[0-9]{1}" /&gt;
    &lt;input type="text" class="passInput" name="pass[]" maxLength="1" size="1" autocomplete="off" min="0" max="9" required pattern="[0-9]{1}" /&gt;
    &lt;input type="text" class="passInput" name="pass[]" maxLength="1" size="1" autocomplete="off" min="0" max="9" required pattern="[0-9]{1}" /&gt;
    &lt;input type="text" class="passInput" name="pass[]" maxLength="1" size="1" autocomplete="off" min="0" max="9" pattern="[0-9]{1}" /&gt;&lt;br&gt;
    &lt;button type="submit" class="btn btn-lg btn-primary" style="margin: 30px 0 50px;"&gt; submit
           &lt;/button&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>