I\'m trying to remove everything in the whole body, except of a single element and its children. How can I accomplish this?
Edit 1 Consider the foll
This code worked for me.
$('body > * :not(#123)').remove()
You need to give space between * and : . Earlier when try to use the code with
$('body > *:not(#123)').remove() it did not work. I had to give space between * and : character.
$('body > *:not(#123)').remove()
Happy coding.