title: I want the textbox to not display a number higher than the maximum
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1125482/how-to-impose-maxlength-on-textarea-in-html-using-javascript">How to impose maxlength on textArea in HTML using JavaScript</a>  </p>
  </blockquote>
  
  
  
  <p>I have a grid of buttons where the user selects a button. Lets ignore buttons "True or False" and "Yes or No", the other buttons go from "3" to "26". Now there is a text-box (<code>#numberAnswerTxt</code>), where the user can select the number of answers the user wants. Now what I want to do is that the user cannot type in a number in the text-box which is more than the number of options from the button.</p>
  
  <p>So for example if the user select button "3" from the grid, then in the text-box the user can only type in the number 3 as the maximum number in the text-box, if the user types in a higher number then the text-box should automatically change the number to the highest number which is "3".</p>
  
  <p>Another example is that if the user select button "21" from the grid, then in the text-box the user can only type in the number 21 as the maximum number in the text-box, if the user types in a higher number then the text-box should automatically change the number to the highest number which is "21".</p>
  
  <p>Does anyone know how to do this?</p>
  
  <p>The code is in jsfiddle, click <a href="http://jsfiddle.net/aMmNL/" rel="nofollow noreferrer">here</a></p>
  
  <p>Thank You</p>