1
votes

I'm using the bootstrap datepicker in my application. (see https://uxsolutions.github.io/bootstrap-datepicker/?markup=component&format=&weekStart=&startDate=&endDate=&startView=0&minViewMode=0&maxViewMode=4&todayBtn=false&clearBtn=false&language=en&orientation=auto&multidate=&multidateSeparator=&keyboardNavigation=on&forceParse=on#sandbox) for example.

Currently when i click on the input text of the calendar, the component show even if i don't release the mouse click.

Do you know if it's possible to change the behavior in order to show the component only on mouse click released?

I tried some tests with catching the event on click of the input text but did not succeed.

Thanks!

1

1 Answers

0
votes

There are 2 events you can use instead of click if you want finer control over the click event : mouseup and mousedown

elem.addEventListener('mousedown', e => {
  x = e.offsetX;
  y = e.offsetY;
});

elem.addEventListener('mouseup', e => {
  x = e.offsetX;
  y = e.offsetY;
});

More documentation here https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseup_event