This detects it
1 2 3 4 5 6 7 8 9 10 |
<input type="text" id="txt"/> $('#txt').keydown(function (e){ if(e.keyCode == 13){ alert('you pressed enter ^_^'); } }) |
and this prevents it
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<script> $(document).ready(function() { $(window).keydown(function(event){ if(event.keyCode == 13) { event.preventDefault(); return false; } }); }); </script> |