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

124
Views
Selector de fecha no funciona en html generado por javascript

Con jquery, agrego algunas entradas de formulario html a mi sitio con un clic de botón, como estas:

 html += '<div class="form-group my-4">'; html += '<span class="left">Date of ending work <span class="carer_help">Required format: 01-01-2000</span></span>'; html += '<span class="left"><input class="form-control datepicker" type="text" required="required" name="work_end[' + works_row_melleklet + ']" value="'+work_end+'" /></span>'; html += '</div>';

Puede ver que la entrada tiene la clase datepicker. Pero mi problema es que el calendario del selector de fechas no aparece. Creo que, porque la entrada html, donde quiero usar el calendario, no está en la fuente del sitio, solo se agrega mediante javascript al hacer clic en el botón.

¿Cómo puedo arreglar esto?

 $('.datepicker').datepicker({ format: 'dd-mm-yyyy', language: 'en', autoclose: true, todayHighlight: true });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Cuando agrega entradas dinámicas al DOM, debe reiniciar con el método datepicker nuevamente.

 $('body').on('focus',".your_parent_div_name_where_datepicker_is_added", function(){ $(this).removeClass('hasDatepicker').datepicker(); });​
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!