Javascript examples for Canvas:Mouse
Capturing click event on a canvas
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> $(window).load(function(){//from w ww. j ava2 s .c o m var can = document.getElementById('canvas1'); var ctx = can.getContext('2d'); can.addEventListener('mousedown', function() {console.log('down!')}, false); }); </script> </head> <body> <input style="position: absolute;" value="some input"> <canvas id="canvas1" width="500" height="500" style="border: 1px solid black;"></canvas> </body> </html>