If I have a string that contains this.
Hi my name is <span class="name">Joe</span>. Just wanted to say <b>Hi</b>.
And I want to remove certain tags including what fills it. Example with this string would be the <span> tag only.
I would remove
<span class="name">Joe</span>
…and the finished output would be
Hi my name is . Just wanted to say <b>Hi</b>.
How would I do this?
You could either do this with
or
Pick the second one if you only want to remove the element with the class “name”.
A working example: http://jsfiddle.net/ZWw6d/
Have a look at the documentation: http://api.jquery.com/remove/