Để cập nhật hình chữ nhật canvas HTML5 khi di chuột, hãy thử chạy mã sau:
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
context.rect(20,20,150,100);
context.stroke();
$(canvas).hover(function(e){
context.fillStyle = blue;
context.fill();
});