title: Set value if entered value is more than a {number}
body: <p>I have a block, width and height of which I want user to set by entering a value in the input. </p>
  
  <p>I also want the value of inputs not to be more than certain number. Seems like I can't get <code>parseInt</code> to work..</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>if (parseInt($("#stwidth").val(), 10) &gt; 113) {
    $("#stwidth").val("113");
  }
  
  if (parseInt($("#stwidth").val(), 10) &gt; 62) {
   $("#stheight").val("62");
    
  }
  
  $("#stwidth, #stheight").keyup(function () {
    $('.preview').css({width: $("#stwidth").val() + "mm", height: $("#stheight").val() + "mm"});
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.preview {
      width: 55mm;
      height: 19mm;
      background: #fff;
      overflow: hidden;
      border: 2px solid #3e6eb0;
      margin: 50px 0;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input type="text" name="stwidth" id="stwidth" value="55" maxlength="3"&gt; x 
  &lt;input type="text" name="stheight" id="stheight"  value="19" maxlength="2"&gt; 
  
  &lt;div class="preview"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>