views:

382

answers:

1

Hi! I'm trying to copy element from one in my page to another (via javascript). It's successfully copied but appeared empty.

How to copy/move canvas with content?

+1  A: 

I think the spec tells that a canvas is cleared when resized, I guess it is the same when cloned in the DOM too. So you need to get the image data with getImageData and put it back with putImageData

See here.

Fabien Ménager