Jquery: Strip all specifc HTML tags from string
===

I have a variable that contains a string of text and html tags, such as:

    var temp="<div>Some text</div><p>More text<span>here</span></p><p>Even more</p>"

I would like to remove all tags of a certain type. Let's say all <p> and <span> tags for example.

This is the best I can come up with:

    var temp="<div>Some text</div><p>More text<span>here</span></p><p>Even more</p>";
    var $temp=$(temp);
    $("p", $temp).replaceWith("foo");
    alert ($temp.html());  //returns "Some text"

There are a number of other similar questions on SO, but none of the responses have helped me with this issue. The closest response I could find is this answer by Nick Craver: <http://stackoverflow.com/questions/3797385/strip-span-tags-from-string-with-jquery>. 

Any help will be appreciated.