html:

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="../css/styles.css"> </head> <body> <form id = "mainForm"> <div id = "div1"> <input type="text" name="input-1" id = "input1" value="" size="10px"> <input type="text" name="input-2" id = "input2" value="" size="10px"> <input type="text" name="input-3" id = "input3" value="" size="10px"> <input type="text" name="input-4" id = "input4" value="" size="10px"> <select id="listColor"> <option value="green"> Зеленый </option> <option value="red"> Красный </option> <option value="blue"> Синий </option> <option value="yellow"> Желтый </option> </select> </div> <div id = "div2"> <input type="reset" name="Очистка формы"></td> <button id = "showButton" >Отобразить данные</button> <button id = "insertButton">Вставка текстового поля</button> </div> </form> <script src="../js/index.controller.js" type="text/javascript"></script> 

How to make automatic movement of focus from one input field to the next after filling in JS?

  • But how should the script understand that the input is completed, on which event? - Vadim Leshkevich
  • I ask this - bsuart
  • What are you asking? How does the script know what you want to enter, have you finished typing or do you want to add more characters? How can he know my name is Vadim or Vad? - Vadim Leshkevich
  • There must be some event by which you can understand that the input is complete, for example, the length of the entered text is equal to a certain value or press enter, etc. - Vadim Leshkevich
  • Understand, in order to do this, the script must be taught to understand that the input is finished, for this it is necessary to designate any criteria and they must depend directly on the type of information entered. For example, a point was entered, or after the dog there is a point and 2 or 3 characters. Or 11 numbers in a row ..... - pepel_xD

0