javascript - How to Replace an element with another element entirely with data and events? -
i have cloned element this
var myvar = null; myvar = $(someothervar).clone(true, true)
now want replace anothervar
entirely myvar
. how that?
i tried $(anothervar).replacewith(myvar)
doesn't work. other way replace anothervar
entirely data , events of myvar
?
update
since want 2 references:
var myvar = $(someothervar).clone(true, true); var anothervar = $(myvar).clone(true, true);;
if need 2 clones, have clone twice. there's no way around it.
Comments
Post a Comment