In my form, I have three select elements, which are Month, Day, and Year. What I'm achieving is, if the user selects a month, the days must match according to what month the user has selected.
For example, January(1-31), May(1-30), February(1-28).
In my form, I have three select elements, which are Month, Day, and Year. What I'm achieving is, if the user selects a month, the days must match according to what month the user has selected.
For example, January(1-31), May(1-30), February(1-28).
function GetDays(year, month) {
var isLeapYear = ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0);
return [31, (isLeapYear ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
}
Call GetDays function on change event of month selection control