Having an issue with setting a minimum date on the date picker when the field is in a collection.
I am using the code below to set the minimum date to the current date. Works great on the first entry in the collection but does not work on any entries added to the collection.
Would anyone be able to tell me how to modify the code so it works for each entry in the collection?
Thanks.
$(function() { $(document).ready(function () { var todaysDate = new Date(); // Gets today's date // Min date attribute is in "YYYY-MM-DD". Need to format today's date accordingly var year = todaysDate.getFullYear(); // YYYY var month = ("0" + (todaysDate.getMonth() + 1)).slice(-2); // MM var day = ("0" + todaysDate.getDate()).slice(-2); // DD var minDate = (year +"-"+ month +"-"+ day); // Results in "YYYY-MM-DD" for today's date // Now to set the min date value for the calendar to be today's date $('.datePickerMinCurrent input').attr('min',minDate); }); });