Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
onchange element.appendChild una y otra vez
<p class="label"> <form id="links"> <input type="text" class="insert" name="input" onchange="createLink()"> <br> </form> </p> </div> <script> function createLink() { var newline = document.createElement("br"); var input = document.createElement("input"); input.type = "text"; input.name = "input"; input.onchange = "createLink()"; var element = document.getElementById("links"); element.appendChild(newline); element.appendChild(input); } </script>

Intenté repetir la creación de un nuevo campo de entrada nuevamente desde el nuevo campo de entrada, pero solo es posible desde mi primer campo de entrada. ¿Por qué? y cual es la mejor solucion

about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

Usa este código. Espero que este código funcione, quieres decir)

 <p class="label"> <form id="links"> <input type="text" class="insert" name="input" onchange="createLink()"><br> </form> </p> <script> var element = document.getElementById("links"); function createLink(){ var newline = document.createElement("br"); var input = document.createElement("input"); input.type = "text"; input.name = "input"; input.addEventListener('change', createLink) element.appendChild(newline); element.appendChild(input); } </script>
about 4 years ago · Santiago Gelvez Report

0

Su implementación está un poco fuera de lugar. En lugar de pasar createLink como cadena. páselo como función de flecha, como se muestra a continuación:

 <p class="label"> <form id="links"> <input type="text" class="insert" name="input" onchange="createLink()"> <br> </form> </p> </div> <script> function createLink() { var newline = document.createElement("br"); var input = document.createElement("input"); input.type = "text"; input.name = "input"; input.onchange = ()=> createLink(); var element = document.getElementById("links"); element.appendChild(newline); element.appendChild(input); } </script>
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!