I have two elements #DateTimeStart, #DateTimeEnd, I would like apply my datetimepicker to both.
With this code I cannot have the result.. any idea what I am doing wrong here?
$(document).ready(function () {
// This does not work
$('#DateTimeStart', '#DateTimeEnd').datetimepicker({
addSliderAccess: true,
sliderAccessArgs: { touchonly: false }
});
});
What I am trying to achieve is like but with less code
// This code works
$(document).ready(function () {
$('#DateTimeStart').datetimepicker({
addSliderAccess: true,
sliderAccessArgs: { touchonly: false }
});
$('#DateTimeEnd').datetimepicker({
addSliderAccess: true,
sliderAccessArgs: { touchonly: false }
});
});
Just separate selector with comma:
$("#DateTimeStart, #DateTimeEnd").datetimepicker({
addSliderAccess: true,
sliderAccessArgs: { touchonly: false }
});
In jQuery documentation it is called as Multiple Selector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With