In this blog, I will show how to disable the Enter key on a Web page using JQuery. Follow the steps mentioned below:
Step 1: Download the attached jQuery, add on your project and include this in your Web page.
- <script type="text/javascript" src="js/36d/jquery-1.4.2.min.js"></script>
Step 2: Add below code on your page between head tags.
- <script type="text/javascript">
- $(document).ready(function () {
- $("form").bind("keypress", function (e) {
- if (e.keyCode == 13) {
- return false;
- }
- });
- });
- </script>
Step 3: Run your page and check. Try to use ENTER key.