how to clone content of a div to another div

pahnin picture pahnin · Oct 23, 2010 · Viewed 89.8k times · Source

I want to copy the content of a selected div to another div with jquery clone. but I dont want to append it anywhere

what I mean is when we make a clone of a div with jquery (correct me if i am wrong) we have to set its position and it will dynamically create a new division which is displayed.

but I want to get the content of a selected div and copy it to another pre-set div

Answer

Val picture Val · Oct 23, 2010
var a = $('#selector').html();
var b = $('#selector').html(a);

not sure I understood you properly but I think thats what you meant :)