It seems like you are looking for something like this:
$("body").children().filter(":gt(5)").remove();
The above removes all the direct children of body
with an index over 5. This is assuming body
is the top of the DOM in question. if not, you can change body
to be whatever the head of the DOM you want to "prune" is.