clone - jQuery Cloning Parent Element -
i'm wanting clone parent element. i've managed clone contents of element.
$(this).parents('.row').clone();
this returns contents of .row, how may clone .row element?
fiddle - give last input value
what don't include you're using .html()
in jsbin code, what's returning inner part of row.
to "combat" this, use temporary container , .html()
on container:
$('<div>').append($(this).parents('.row').clone()).html();
http://jsbin.com/fesicaqotu/1/edit?js,output
another, perhaps better option, use .outerhtml
on dom element , forget clone altogether:
self.parents('.row')[0].outerhtml;
Comments
Post a Comment