Follow by Email

Monday, April 29, 2013

disable Enter Keyboard Button using Javascript.


In this post i will show how to disable Enter Keyboard Button using Javascript.

Below is the Javascript code we will be using. "Enter" keyboard button code is 13, Hence in the javascript code we will return false for keycode 13. Thus Event for Enter button would not get triggered.
We will call this function in the html body tag on the onkeydown property of it.


<script type="text/javascript">
        function disableEnter() {
            if (event.keyCode == 13) {
                return false;
            }
        }
    </script>




















After adding this javascript function run your project to get the expected output.