limit values for oninput calculation without limiting the input values - HTML CSS CSS Form

HTML CSS examples for CSS Form:input

Description

limit values for oninput calculation without limiting the input values

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
 </head> <!--from   w ww.j av  a2 s  .  co m-->
 <body> 
  <form oninput="x.value = Math.min(Math.max(5,parseInt(a.value)+parseInt(b.value)),195);"> 
   <input type="range" id="a" value="50">Lorem i 
   <input type="number" id="b" value="50">Lor 
   <output name="x" for="a b"></output> 
  </form>  
 </body>
</html>

Related Tutorials