Hi everyone.
I'm using this markup
- <label> Date <input type="text" data-datepicker="{maxDate: '+1d'}" /></label>
- <label> Another date <input type="text" data-datepicker="" /></label>
- <script>
- $('[data-datepicker]').each(function() {
- // init the options var with some default values (dateFormat etc)
- // that can be overridden by the data-datepicker values
- // also, new values can be added to the options from data-datepicker
- // such as "maxDate"
- var options = TODO;
- $(this).datepicker(options);
- });
How do I go about writing that code? Starting with the default values seems like a good start
- var options = { dateFormat: 'yy-mm-dd };
But then how I add/overwrite with values from the data-attribute .. I just don't know.