I\'m using two dropdown(month, year). I\'ve to restrict future month based on year. suppose if I choose \'2014\', it should show the months till January.I don\'t have any clue h
try this way
$('#year').on('change',function() {
var currMon= (new Date).getMonth();
var currYear = (new Date).getFullYear();
if(currYear === $('#year :selected').text()){
$('#month option:eq('+currMon+')').prop('selected', true);
$('#month').prop('disabled',true);
}
else{
$('#month').prop('disabled',false);
}
});
Note: the value of the month select should be 0
to 11
representing jan to dec
Happy Coding :)