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

265
Views
Al hacer clic en el elemento secundario, se activa el botón principal

Tengo 1 función que crea una nueva casilla de verificación con un botón Eliminar para eliminarla. Sin embargo, cuando se usa onclick para el botón de eliminar, se elimina cuando se activa la casilla de verificación de creación, de modo que no hay nada en primer lugar.

 <script> var list = document.getElementById("list"); var i = 0; function add_client(form) { var div = document.createElement("div"); div.setAttribute("id", "div"+i.toString()) var check = document.createElement("input") check.setAttribute("type", "checkbox"); check.setAttribute("id", "check"+i.toString()); var label = document.createElement("label"); label.setAttribute("for", "check"+i.toString()); label.setAttribute("id", "label") txtNode = document.createTextNode(form.value); label.appendChild(txtNode); var br = document.createElement("br"); div.appendChild(check); div.appendChild(label); list.appendChild(div) i++; var del = document.createElement("input"); del.setAttribute("type", "button"); del.setAttribute("value", "Delete"); del.setAttribute("id", "del") div.appendChild(del); del.onclick = del.remove(); div.appendChild(br); } </script>

Sé que se trata de un problema de DOM, pero no puedo evitarlo... ¿alguna idea?

about 4 years ago · Juan Pablo Isaza
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!