0

I have a x3dom object on my webpage and when I press "T" it shows me that top view of my modal (It is a default functionality, I have not implemented JS for that).

Question is: How can I mimic that functionalty that is assigned to a button click with JS?

  • 1
    possible duplicate of [Trigger a keypress/keydown/keyup event in JS/jQuery?](http://stackoverflow.com/questions/3368578/trigger-a-keypress-keydown-keyup-event-in-js-jquery) – SOReader Feb 26 '15 at 12:17

1 Answers1

0

You can do like this:

     <script>
        $(function() {
            $(document).keypress(function(e) {
                pressedkey=e.which;             
                if(pressedkey==65) // Character 'A'
                {
                    alert('You pressed "A"');  //Do whatever you want
                }
                else if( pressedkey==97) // Character 'a'
                {
                    alert('You pressed "a"'); //Do whatever you want
                }
            });
        });
     </script>

This may helps you.

Sharry India
  • 341
  • 1
  • 9