I'm having a bit of trouble understanding why a click event attached
to the document is being triggered when submitting a form through the
enter key. Here's my setup:


<html>
<head>
        <script type='text/javascript' src='http://ajax.googleapis.com/ajax/
libs/jquery/1.3.2/jquery.js'></script>
        <script type='text/javascript'>
                $(function(){
                        // Form Submission
                        $('form').bind('submit', function(event){
                                console.log('Submit: ', event);
                                return false;
                        });
                        // Input events
                        $('input[type=text]').bind('keyup', function(event){
                                console.log('Keyup: ', event);
                        }).bind('keydown', function(event){
                                console.log('Keydown: ', event)
                        });
                        // Doc Click
                        $(document).click(function(event){
                                console.log('Document Click: ', event);
                        });
                });
        </script>
</head>
<body>
        <form action='test.html' method='GET'>
                <input type='text'>
                <input type='submit' value='Submit'>
        </form>
</body>
</html>



Any ideas?

Reply via email to