Displaying field text in an adjacent field?

  • 0
    Idea: there are two mail input and now the user puts the focus in the first field and drives in his email, meanwhile, the value entered in the first field appears in the next field, and as a result, after filling the first field, the second field is automatically already filled in with the same mail that he entered user, I hope I understood it clearly, please tell me how to do this? In pure JavaScript please
    JavaScript Reece Lawson, Nov 30, 2020

  • 1 Answers
  • 0
    <input type="text" id="email">
    <input type="text" id="email2">

    const email2 = document.querySelector("#email2");
    document.querySelector("#email").addEventListener("input", e => email2.setAttribute("value", e.target.value));

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!