Question: Something like I am have:

```

    function mouseClick(event) {
        ...
    }
    canvas.addEventListener("mousedown", mouseClick, false);
    function drawRect(x, y) {
        context.fillRect(x, y, 16, 16);
    };
    drawRect(10, 10);

```

How to do something like if I am click on my Rect in Canvas get something? something like If I am click on Rect get alert;

Sorry for my English language.

Answer: 
```
$(canvas).mousedown(function myDown(e) 
{
  var position = $(canvas).position();
  var x = e.pageX-position.left;
  var y = e.pageY-position.top;
  ...
});

```

This is much better way to do this!
You could also try out Concrete.js <http://www.concretejs.com> which is a lightweight canvas framework that adds interactivity. You would just do something like this:

var key = canvas.getIntersection(x,y);

if x,y intersects a graphic you've drawn with a given key, it returns the key, and you know what was hovered/clicked on.

This is a much better solution because it will work on anything you draw, including circles, lines, curves, polygons, arbitrary blobs, etc.