title: Javascript min max
body: <p>In PHP you can use this to keep a number between 2 values, minimum and maximum:</p>
  
  <p><code>$n = min(max($n, 1), 20);</code></p>
  
  <p>so if $n is larger than 20 it will take the value of 20.
  If it's smaller than 1 it will take the value of 1. Otherwise it will not change</p>
  
  <p>How can I do this in javascript / jQuery ?</p>