JavaScript Tutorial – Dynamic Select Year List Script HTML Form Elements

Lesson Code:
PHP Version:
Learn to program dynamic year select lists in HTML forms to avoid the need to write up to 100 lines in your HTML. The JavaScript loop will write the options for you in a for loop. We can do this easily because years are numeric and incremental.


20 thoughts on “JavaScript Tutorial – Dynamic Select Year List Script HTML Form Elements”

  1. What if you have Lets say a Music List an Artist list and a Song List. How do you link them together to choose the music the artist and the song? Would Love to have an answer please. Thank you.

  2. He already mentioned it in the video. You can do it this way: var date = new Date(); var year = date.getFullYear(); and then in FOR loop go for(var i=1900;i <= year; i++). Hope I helped.

  3. Adam, fabulous! It's because of you I am now at university studying Digital Media, Web Software & Software/Gaming Design! It was by watching your videos and following the first web intersect series I learned PHP, you honestly are amazing; you've literally made my ambition of career possible. Thanks!

  4. I will make another PHP version now. Good point. But not many people would disable JavaScript cuz they would disable almost everything cool/interactive on the web today.

  5. Would there be any advantage to using JavaScript over PHP. If a user has JavaScript disabled this would not work, however it would with PHP.

Leave a Reply

Your email address will not be published. Required fields are marked *