Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

150
Vistas
¿Cómo se puede agregar una casilla de verificación en la entrada de enter?

¿Cómo se puede agregar una casilla de verificación en la entrada de enter?

 <html> <head> </head> <body> Search: <input onkeyup="myFunction()" type="search" id="mySearch" value=""> <p>Click the button to display the value of the value attribute of the search field.</p> <p id="demo"></p> <table id="table"> <tr> <td></td> </tr> </table> <script> function myFunction() { if(event.keyCode === 13){ debugger; var table = document.getElementById("table"); var row = table.insertRow(-1); var date = row.insertCell(0); table.appendChild(row); date.innerHTML = document.getElementById("mySearch").value; //insert checkbox// function editTd() { var rows = document.getElementById('table').rows; for (var i = 0; i < rows.length; i++) { var row = rows[i]; for(var j =0; j<row.cells.length; j++){ var inputs = document.createElement("input"); inputs.type = "checkbox"; rows.cells[j].appendChild(inputs); }; }; }; editTd(); } } </script> </body> </html>

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

solo necesita modificar la línea a esto:

 rows[i].cells[j].appendChild(inputs);

o posiblemente

 rows[0].cells[j].appendChild(inputs); 

 <html> <head> </head> <body> Search: <input onkeyup="myFunction()" type="search" id="mySearch" value=""> <p>Click the button to display the value of the value attribute of the search field.</p> <p id="demo"></p> <table id="table"> <tr> <td></td> </tr> </table> <script> function myFunction() { if (event.keyCode === 13) { debugger; var table = document.getElementById("table"); var row = table.insertRow(-1); var date = row.insertCell(0); table.appendChild(row); date.innerHTML = document.getElementById("mySearch").value; //insert checkbox// function editTd() { var rows = document.getElementById('table').rows; for (var i = 0; i < rows.length; i++) { var row = rows[i]; for (var j = 0; j < row.cells.length; j++) { var inputs = document.createElement("input"); inputs.type = "checkbox"; rows[i].cells[j].appendChild(inputs); }; }; }; editTd(); } } </script> </body> </html>

muestra 2 casillas de verificación, por lo que si eso no es lo que quería, solo necesita cambiar la lógica de bucle. espero que esto ayude

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda