strip unwanted html elements by retaining its content using JQuery
<p>I have an input with lots of html content. looking for a jquery function to efficiently strip the unwanted elements(just the elements, but would need to retain the content), the elements to retain would be the ones which i specify.
Also would like the function to be easily configurable to add or remove the elements i dont want. eg:
var tagsToRetain="p,i,u,br";</p>

<p>I have tried below, but that would require to specify the elements that i don't want, which would be tedious to do so.</p>

<pre><code>$("span,h1,h2").each(function(){
$(this).replaceWith($(this).html());
});​
</code></pre>
