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

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -