title: Auto set minimum and maximum value on textbox
body: <p>I want to make the textbox automatically set the maximum value when the user put the value above the maximum value. Example min is 0 and max is 255. When user put 999 in the textbox, it automatically set to 255 as the max value. When user put -11 on textbox, it automatically set to 0 as the min value. You can see the gif animation below how it should work</p>
  
  <p><img src="https://i.stack.imgur.com/93Tqg.gif" alt="http://i.stack.imgur.com/93Tqg.gif"></p>
  
  <p>I had tried <code>if else</code> statement but it could not convert string to <code>int</code>.</p>