Switch from one input to another automatically

0

Working with ionic I have three inputs with 4 digits each

What I try to do is that when someone puts the first 4 numbers in the first input automatically pass to the next input without having to use tabindex, if someone could guide me a little I would appreciate it

    
asked by Carlos 19.07.2018 в 15:04
source

1 answer

1

In the end I was able to get it out with the help of the focus function, I leave the solution, hopefully the problems will always come out fast

        <input type="text" placeholder="code"  maxlength="4" onkeyup="if (this.value.length == this.getAttribute('maxlength')) input2.focus()" /> 

        <input type="text" id="input2" placeholder="code" maxlength="4" onkeyup="if (this.value.length == this.getAttribute('maxlength')) input3.focus()" /> 

        <input type="text" id="input3" placeholder="code" maxlength="4" onkeyup="if (this.value.length == this.getAttribute('maxlength')) " /> 
    
answered by 19.07.2018 в 15:52