Recommand · June 9, 2021 0

AutoTab Function with a input tag and a button

I already searched here and find some solutions with tab for the next input,I tryied to adapte this function to my code but unsuccessfully, just want to tab a input to a button when its catch up 6 lenght, then auto press enter, to send the data, onpage load, returns to the input and erase data, tryied this:

$("#PopID-Lido").keyup(function () {
    debugger
        if (this.value.length == this.maxLength) {
          $(this).next('#senData').focus();
        }
  });

I not try to auto press enter and pageload because I get stucked with this…
html:

<div class="container-fluid">
    <div class="container-popid" for="PopID-Lido">POPID ATUAL <!--<span id="actPopid"> </span> -->

        <form>
            <input type="text" id='PopID-Lido' class='PopID-atual PopID-Lido' maxlength="6">

        </form>
    </div>
    <br>
    <div class="container-NextPopID" for='Next-PopID'>PRÓXIMO POPID 
         <output type="text" id="NextPopID" class='Next-PopID NextPopID'>  
    </div>

</div>

<br><input type="button" id="senData" value="Send to PLC">