Javascript examples for jQuery Method and Property:keyup
Print keyup element value
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-2.0.0b1.js"></script> <script type="text/javascript"> $(window).load(function(){//w ww . j a va 2s . c o m var prevVal = ''; $('.someClass').on('keypress', function (e) { prevVal += String.fromCharCode(e.which); console.log(prevVal); }).on('keyup', function() { prevVal = $(this).val() }); }); </script> </head> <body> <input class="someClass"> </body> </html>