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

205
Views
deje de restablecer la entrada de selección cada vez que se agregue una nueva opción de selección cuando se haga clic en el botón

Creo con éxito una nueva selección si se hace clic en el botón. pero, ¿cómo dejo de actualizar la selección cada vez que agrego otra selección?

Es un poco difícil para mí explicarlo, pero aquí está el código:

 <body> <table> <tr> <td class="here" colspan="2"> </td> </tr> <tr> <td colspan="2" ><a style="color: #4F7942; cursor: pointer;" onclick="add()">Add Select</a></td> </tr> </table>
 function add(){ var container = document.querySelector(".here"); if(container){ container.innerHTML += ` <table> <tr> <td> <select class="abc" name="any[]"> <option value="" selected disabled>Select....</option> <option>1</option> <option>2</option> <option>3</option> </select> </td> </tr> </table> `; }

}

https://jsfiddle.net/idfrnffnd/akjpLc2y/4/

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No debe alterar innerHTMl , en su lugar, use container.insertAdjacentHTML

 function add(){ var container = document.querySelector(".here"); if(container){ container.insertAdjacentHTML('beforeend', ` <table> <tr> <td> <select class="abc" name="any[]"> <option value="" selected disabled>Select....</option> <option>1</option> <option>2</option> <option>3</option> </td> </tr> </table> `); } }
 <table> <tr> <td class="here" colspan="2"> </td> </tr> <tr> <td colspan="2" ><a style="color: #4F7942; cursor: pointer;" onclick="add()">Add Select</a></td> </tr> </table>

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