I have a list of elements with the same class, like this:
<div>
<input type="text" name="date_time[]" class="datetime_input" />
<input type="text" name="date_time[]" class="datetime_input" />
<input type="text" name="date_time[]" class="datetime_input" />
<input type="text" name="date_time[]" class="datetime_input" />
<input type="text" name="date_time[]" class="datetime_input" />
</div>
And jQuery for turning a text input into datetime picker.
$(".datetime_input").datetimepicker();
The problem here is that if I click to the first input and set a value, then after choosing the value, this value will be inserted to all inputs with class datetime_input. But I would need to insert this value only to the input I clicked in.
A solution would be to add a unique ID to each input - but because I load those inputs from database, I don't know their count.
How to solve the situation?
Aucun commentaire:
Enregistrer un commentaire