0

After adding new rows in a table when I focus on date it shows the date picker, but when I choose date it changes the date in first row of the table. How can I overcome this problem?

  1. First Date Before Adding New Row First Date Before Adding New Row
  2. Second Row Date Before Date Picking 2nd img
  3. Third After date Select, it Change the First One Not the Row I want to change enter image description here

I'm trying these things. I've also changed 'body'->document.

let datepickeropt = {
  dateFormat: 'dd-mm-yy',
  changeMonth: true,
  changeYear: true,
  showAnim: 'slideDown',
  duration: 'fast',
  yearRange: new Date().getFullYear() + ':' + new Date().getFullYear(),
}

$('body').each(function(i, element) {
  $(this).on('focus', '.date_pick', function() {
    $(this).datepicker(datepickeropt);
  });
});
isherwood
  • 58,414
  • 16
  • 114
  • 157
Mani-Peer
  • 1
  • 3
  • Your question is difficult to answer because you haven't shown us enough code. We don't know how you're adding date picker events to the new rows. Please see [ask]. – isherwood Jun 27 '23 at 13:36

0 Answers0