Javascript examples for jQuery:Form Text Input
Change div value based on textbox value using jQuery
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.6.2.js"></script> <script type="text/javascript"> $(window).load(function(){//from ww w . j a va2s.com var max = 10; $('input').keyup(function() { var v = $(this).val(); v = isNaN(v) ? '' : v; v = v > max ? max : v; $(this).val(v); $('div').html(v * 10); }); }); </script> </head> <body> <input> <div></div> </body> </html>