jQuery.fn.removeTags = function()
{
this.each(function()
{
if(jQuery(this).children().length == 0)
{
jQuery(this).replaceWith(jQuery(this).text());
}
else
{
jQuery(this).children().unwrap();
}
});
return this;
};
jQuery("#container").find(":not(b, strong, i, em, u, br, pre, blockquote, ul, ol, li, a)").removeTags();
Make sure the container is no larger than the tag body. Or, you may experience problems when you receive the tags head, html, scriptetc.
Also, if you want: there cannot be a list, and you could:
var mylist = ["b" ,"strong", ... etc. etc.];
jQuery(":not(" + mylist.join(", ") + ")").removeTags();
removeTags. ( ...)
EDIT:, : Javascript . , , . , remove() , megakorre.