user3391137 user3391137 - 1 year ago 79
Javascript Question

How to load the datapicker of the following context inside <td> </td>?

enter image description here

In he above code, I would like to add datepicker of input field which contains id as datepicker.

For this purpose i used the following js code in document.ready() func

$("tbody#docTab").click(function() {
var row = $(this).closest('tr');

But i does not appear the datepicker while onclick the input field, What i have missed on this code?
Advanced thanks.

Answer Source

assign unique id to each element in html, here ids are being duplicated - instead of assigning same id to multiple inputbox - I would suggest add class "datepicker" to every input to whom you want to add datepicker:

   <input  type="text" name="sdate[]" class="datepicker" value="0000-00-00" />
   <input  type="text" name="edate[]" class="datepicker" value="0000-00-00" />

and in jquery:

  $('.datepicker').removeClass('hasDatepicker').datepicker();  // you can directly add datepicker using its class name      
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download