I am a bit confused on the difference between jQuery $.clone and the raw .cloneNode property.
If I am doing
$('blah').cloneNode(true) this will create a global object outside of the jQuery space.
If I use
$('blah').clone(true) this will create a jQuery object inside the jQuery space but copy everything including events ?
If I am using jQuery should I stick with .clone and if I change my code from .cloneNode will there any effect ?
A few things. You call
cloneNodeonthisnot$(this). Second, withcloneNodeyou can’t clone the events associated with the original node, whereas with jQuery’sclone, it clones the events and data (if the first flag is set). Setting the second flag ofcloneclones the original element’s children and their elements.Use accordingly, according to your needs.