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

167
Vistas
Javascript cloned new row doesn't have selected selectbox input

i have cloned my first row values to second row and so on, it works for inputs and time variables etc.. everything except selectbox values

    function cloneRow() {
          var row = document.getElementById("rowToClone"); // find row to copy
          var table = document.getElementById("tableToModify"); // find table to append to
          var clone = row.cloneNode(true); // copy children too
          clone.id = "newID"; // change id or other attributes/contents
          table.appendChild(clone); // add new row to end of table
          }

EDIT: found workaround for selectbox not cloning. simply add onchange to selectbox and update function.

  <select id="transports" name="schedule_type[]" onchange="update(this);">
            <option value="" disabled selected>Choose Type</option>
            <option value="Weekday">Weekday</option>
            <option value="Holiday">Holiday</option>
            <option value="Friday">Friday</option>
            <option value="Sunday">Sunday</option>  
            </select>

         function update(val){
          val.options[val.selectedIndex].setAttribute("selected","");
          }
about 4 years ago · Juan Pablo Isaza
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