Change the font size with an input type number - Javascript jQuery

Javascript examples for jQuery:Form Number Field

Description

Change the font size with an input type number

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from   w ww  . j av a 2  s.com*/
$("input[type=number]").keyup(function(){
    var fontSize = $(this).val();
    $("p").css({"font-size":fontSize+"px"});
});
    });

      </script> 
 </head> 
 <body> 
  <input type="number" placeholder="start typing your number"> 
  <p>Hello</p>  
 </body>
</html>

Related Tutorials