html5 - How to get a canvas element with JQuery? -
i've read: canvas - use []
var canvas = $("#canvas1")[0]; var x = canvas.getcontext("2d"); x.fillrect(50, 40, 55, 55); /*var d = $("#div1"); d.css("background-color", "blue");*/
why can element, e. g. <div>
id, if want canvas, must use [0]
? not work without.
Comments
Post a Comment