I have a form where I want people to put in their year of birth. You can only apply if you are over 18 so in the year of birth field I want the min age to be 18. I have done this as shown below however I want to sort the numbers from latest year at the top and oldest year at the bottom. currently I show 1913 first, but I want to show 1994 first. Here is my code
<div id="my-container"></div>
<script>
var d = new Date();
var y = d.getFullYear();
var selectList = "<select>";
for (var x = (y-100); x < (y - 18); x++) {
selectList += "<option>" + x + "</option>";
}
selectList += "</select>";
$('#my-container').html(selectList);
</script>
(y-100),(y-18),<sign, and++operator... For more information, look up for loops.