javascript - Jquery only appends canvas to one of the selected elements -



javascript - Jquery only appends canvas to one of the selected elements -

i have severals span in html layout, each append canvas-element jquery. tried for-each-loop:

$.each($('span'), function(index,element){ element.append('<canvas width="' + element.width + '" height="' + element.heigth + '"></canvas>'); var context = $(element).find('canvas').first().getcontext('2d'); context.drawimage($('img').first(), 0,0); });

but somehow canvas appended first span in layout! why? thanks!

jsfiddle: http://jsfiddle.net/axnyx/

try giving fiddle try.

http://jsfiddle.net/p55t2/1/

width , height functions called. you misspelled height heigth first() doesn't appear working, might want research why.

javascript jquery html canvas

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -