Javascript examples for jQuery:Form Event
Report if keycode and input are not empty
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.0.js"></script> <script type="text/javascript"> window.onload=function(){/* ww w .j a v a2 s. c o m*/ $('#barcode').keypress(function(e) { if (e.which == 13 && this.value) { console.log("This works!"); } }) } </script> </head> <body> <input type="text" id="barcode"> </body> </html>