0

I plan for using this with 'number of month'.

I would like to have one textbox where the user can only enter a number between 1 to 11.

Rob Hruska
  • 118,520
  • 32
  • 167
  • 192
lovepong
  • 625
  • 1
  • 9
  • 19
  • 1
    possible duplicate of [Limit input box to 0-100](http://stackoverflow.com/questions/1384074/limit-input-box-to-0-100) – coreyward Jun 01 '11 at 17:56
  • 1
    @Editors - If you're going to make an edit, at least take the time to fix *all* of the spelling errors in the title and clean up the content a bit. – Rob Hruska Jun 01 '11 at 17:56
  • 1
    possible duplicate of [Restrict numbers and limit them to two](http://stackoverflow.com/questions/5578087/restrict-numbers-and-limit-them-to-two.) – coreyward Jun 01 '11 at 17:57

3 Answers3

6

Honestly, a dropdown (<select>) is far better suited for picking months. It works without JavaScript, provides better accessibility, and will be less error-prone for nerds ("dangit, why isn't this zero-based‽") and normal users alike ("Why do I always forget that July is 7, not 6?").

Matt Ball
  • 354,903
  • 100
  • 647
  • 710
3

You may want to consider using a select element instead of a text box to limit the options.

A newer and nice (IMO) alternative is using HTML5: <input type="number" min="1" max="11" />

js1568
  • 7,012
  • 2
  • 27
  • 47
0

You might want to use a Range Slider control for something like this.

Here is a jquery example

http://jqueryui.com/demos/slider/

BRampersad
  • 862
  • 1
  • 12
  • 25