Hello,
I need some help with JS, i have the following code:
var todaysDate = new Date(); // Gets today's date
// Max 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
var maxDate = todaysDate;
// Now to set the max date value for the calendar to be today's date
$('.test input').on('change', function(){
if ($('.test input[value = "1"]').is(':checked')){
$('.sdate input').attr('min',minDate);
} else {
$('.sdate input').attr(maxDate);
}
});
The Radio button with class test has 4 values, I want that when value 1 OR 3 are selected the date starts from Today, however when the values 2 or 4 are selected the whole calendar should be available...
Thanks in advance!