Javascript Select Box - Age Loop


/ Published in: JavaScript
Save to your folder(s)

I hate manually entering in tons of numbers and tags for numbers, so I made a loop for it.


Copy this code and paste it in your HTML
  1. var i = $('#age').size();
  2. var age = 18;
  3.  
  4. for (i = 0; i < 82; i++) {
  5. $('#age').append('<option>' + age + '</option>');
  6. age++
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.