How to get year dropdown in JavaScript?
First, we're locating our date dropdown by finding the element we gave the ID of date-dropdown . Next, we're getting the current year (as of this writing, 2020) as well as declaring how far back we want to populate our dropdown, which in this example is 1970.
How to create year dropdown in PHP?
</select> box, commonly using a range of years as the options. Writing and maintaining these long list of options/years can be very monotonous via plain HTML. This following codebyte generates a simple select box, with an for each year based on some basic arguments.