Jquery: Strip all specific HTML tags from string -
I have a variable that has a string of text and html tags such as:
CodeI would like to remove all tags of a certain type. For example, we all call
p and
span .
This is the best I can come up with:
The closest response I can find is this answer by Nick Craver.
demo:
$ ('span, p'). . Content (open) ();
Each such element will receive elements and text, and each content will remove the element by wrapping the section.
Based on your current perspective, it will look something like this:
; / P & gt; "; Var $ temp = $ (temp); $ Temp.find ('span, p'). Content (). Opening (). End (). End ();
If you want to continue targeting the original object, you will need to use
.end () to clear the filter.
Comments
Post a Comment