Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing multiple datepicker on same page don't work #61

Open
avlyn92 opened this issue Apr 9, 2021 · 1 comment
Open

Showing multiple datepicker on same page don't work #61

avlyn92 opened this issue Apr 9, 2021 · 1 comment

Comments

@avlyn92
Copy link

avlyn92 commented Apr 9, 2021

Hi, I am having issue where I'm using 2 to 3 datepicker (not dateRangePicker) on the same page of my angular app. Upon clicking on the first input, the datepicker showed up, but the 2nd input onwards are not showing any datepicker pop up when clicking on the input. But when I inspect on the DOM, correct number of datepicker were generated; example I have 3 datepicker on that page, there are total of 3 datepicker elements being rendered on the DOM when inspect.
And the odd part is, even thou there are 3 datepicker elements on the DOM, clicking on the first input will activate all 3 of the datepickers at same time as well (the .active class is present on every datepicker).

Can you let me know how to fix this.
Thanks!

@mymth
Copy link
Owner

mymth commented Apr 12, 2021

I guess you might be doing something like this.

const inputs = document.querySelectorAll('input.date');
for (let i = 0; i < inputs.length; i++) {
  const input = inputs[0];  // <- look at the index
  new Datepicker(input);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants