<script type="text/javascript" src='jquery.js'></script> <script> $('input').on('keyup', function(e) { if (e.keyCode == 13) { alert('send data to server'); } }); </script> <input type=text id=value>