tuyenle tuyenle - 1 year ago 94
Javascript Question

how to retrieve appendTo() in DOM

I appended a cloned element $canvas in DOM to the body using this code

$('.' + $canvas).clone().appendTo('body');

but I need to retrieve it to use it like this

$('ul,.map').mousemove(function (e) {
$('.' + $canvas).offset({
left: e.pageX, top: e.pageY

How do I retrieve a clone $canvas in the DOM?

Answer Source

Try this


However, you're going to run into issues the second time you do your clone, since it will return two elements