Jquery: Strip all specific HTML tags from string -


I have a variable that has a string of text and html tags such as:
 
Code

I 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

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -