Below is my javascript which is used to validate the year entered in textbox but i need to accept only past ten years form the current year for example this is 2018 textbox need to accept past ten years before 2018 and textbox should not accept future years like 2019....................How can i do this
function validateyear(input) {
var year = input.value
var len = year.length;
if (year == "") {
document.getElementById('lblMessage').innerHTML = "Enter year of passing";
}
else {
document.getElementById('lblMessage').innerHTML = "";
if (len < 4) {
input.value = '';
input.focus();
document.getElementById('lblMessage').innerHTML = "Enter valid year of passing";
}
else {
document.getElementById('lblMessage').innerHTML = "";
}
}
}