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

166
Views
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
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!