HTML:
<select id="mdc_TPM_Year" class="comm-input comm-input-lg">
</select>
JQuery:
var now = new Date();
var year = now.getFullYear() - 5;
var optionHtml = '';
for(var a = 1; a <= 11; a++){
optionHtml += '<option>'+year+'</option>';
year = year + 1;
}
$("#mdc_TPM_Year").html(optionHtml);
效果图:
图1
网友评论