Is the usage of
e = elem.clone(true);
elem.remove();
Identical to
e = elem.detach();
If later I append it with
e.appendTo($("#someDiv"));
In jQuery 1.4?
Will the clone(true) method preserve everything using detach() does?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Same same but different: If you just clone a node without assigning it to a variable you will lose the copied node’s reference and therefore any chance to gain a hand on its event handlers and other data (not quite true but its a PITA).
EDIT
Yes, holding a reference to the cloned element you have an exact copy (mind the true param though) that can later be appended to the DOM.