Search code examples
jqueryclone

CSS Clone everything except a div


I want to clone a div, without a specific children.

var clone = $(this).parent().parent().clone(true);

But I want to delete a div inside the clone.


Solution

  • If your div has a unique ID you could just tack on some more methods at the end.

    var clone = $(this).parent().parent().clone(true).find('div#id_name').remove();