freqdec / datePicker

An attempt at writing a flexible, framework free, feature-rich and accessible datepicker
http://freqdec.github.io/datePicker/
MIT License
171 stars 56 forks source link

Abstract element selector #34

Open cazzer opened 10 years ago

cazzer commented 10 years ago

I am working on an application that dynamically generates forms and would like to pass the DOM node into the constructor instead of an element ID, or perhaps even an class name.

cazzer commented 10 years ago

I created this enhancement request thinking it would be simple, but after digging through the source I noticed it is closely couple with the ID string and the effort required might be a bit too high. That said, you may get a higher adoption rate for this component if you abstract the entire constructor a bit more:

datePickerController.create({
  el: "#id", // or ".class" or variable containing DOM node,
  format: "%d/%m/%Y"
});
moshner commented 8 years ago

+1 for this issue. We would like to generate the date picker with a standard class such as .js-datepick so that we can have lots of dates (sometimes hundreds) on the same page without having to generate many new date controllers.