Mouse

This topic describes how your application can receive input from a mouse.


Related Info


The user can interact with your application using a connected mouse.

Figure 1. Mouse

The supported mouse events are described in the W3C Mouse Events.

To receive notifications for mouse events, for example, the click event:

  1. Create a listener for the click event. The listener is notified each time the element is clicked.

    <div id='button' ... onclick='handleKeyClick();'> ... </div>
    

    or

    document.getElementById('button').addEventListener('click', handleKeyClick);
    
  2. Define the listener:

    function handleKeyClick () {
    // Something you want to do
    ...
    }