Hello
How to display year dynamically in dropdownlist using html.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhay ShankerPosted Mar 31, 2015, 9:58 AM
http://stackoverflow.com/questions/18417114/add-item-to-dropdown-list-in-html-using-javascript
Abhijeet SinghPosted Mar 31, 2015, 6:27 AM
http://www.marcfirth.co.uk/PHP-Dynamically-Generated-Year-Dropdown
Khargesh RajputPosted Mar 31, 2015, 6:08 AM
http://jsfiddle.net/s8HaQ/
html code
javascript
var start = 1900;
var end = new Date().getFullYear();
var options = "";
for(var year = start ; year <=end; year++){
options += "";
}
document.getElementById("year").innerHTML = options;