gijgo icon indicating copy to clipboard operation
gijgo copied to clipboard

Multiple instances of Datepicker on same page not working

Open dpetratsch opened this issue 7 years ago • 5 comments

Hi there,

there is an issue with multiple instances of datepicker. If for example i initiate datepicker with a class name like

$('.datepicker').datepicker();
<input class="datepicker" />
<input class="datepicker" />

the datepicker popup is closing itself after about 1 second. It also lacks of self-referencing the input element, instead it references all elements with the class ".datepicker" and all inputs are getting the same date when selecting from the picker.

It works when referencing by id but thats no option for me as this results in senseless code overhead.

dpetratsch avatar Apr 04 '18 20:04 dpetratsch

This is a bug and we are going to fix it in future versions. Please use a referance by id as a temporary solution.

atatanasov avatar Apr 05 '18 07:04 atatanasov

I figured this out today. Easiest workaround is:

$('.datepicker').each(function()` {
  $(this).datepicker()
});

zulus avatar Apr 16 '18 13:04 zulus

Thanks zulus!

dpetratsch avatar Apr 17 '18 07:04 dpetratsch

Running into this issue today, how does it go with a fix?

zoechiad avatar Feb 27 '19 13:02 zoechiad

it continues to happen

laconeo avatar Dec 28 '23 16:12 laconeo