tags:

views:

25

answers:

2

I have inherited some legacy HTML in which it has the following elements in the body of the code:

style

meta

title

How do i remove these with jQuery?

+1  A: 

$('style, meta, title').remove();

This would remove all of the specified elements from the DOM.

P.S. Make sure this is contained in the $(document).ready(), as is good practice for most jQuery code you will have to write.

virstulte
They're called elements, not tags.
You
+1  A: 

If you can find a proper CSS selector to get to the elements you can simply detach them from the DOM:

$(document).ready(function(){
    $('style, meta, title').detach();
});

I highly doubt you really want to detach the <title> element, though.

You