0

I have problem with the indexing of the jQuery timepicker. I display the timepicker with the loop and I want to display timepicker dynamically, but when I select one picker all the rest follow.

It happens because the the picker class is same, I have try to put index on the class name but, it doesn't work, I don't know why. It might have another method to call jQuery by index, please help me.

select one time picker and the rest have same value

var y = 0;
for (let x = 0; x <= $("#dayTbl").val(); x++) {
  formDisplay(x);
  y += x;
}
function formDisplay(x) {
  var formElement =
    "<div id='form' style='display: block'><input class='timepickerStart[" +
    y +
    "]' name='startTime' /><</div>";
  $("#place").append(formElement);
}

$(".timepickerStart[" + x + "]").timepicker();

Don't Panic
  • 13,965
  • 5
  • 32
  • 51
jumper
  • 105
  • 10
  • So you are trying to display the datepicker X different times? Because they ALL would have the same class Name, and thus jquery will only get the first one, and not the subsequent ones... What EXACTLY are you trying to accomplish? – Kasey Chang Jun 06 '20 at 00:05
  • i have edit the class name, – jumper Jun 06 '20 at 07:21

0 Answers0