Peter Peter - 1 year ago 39
Javascript Question

Remove all HTMLtags in a string (with the jquery text() function)

is it possible to use the jquery text() function to remove all HTML in a string?

String with HTML tags:

myContent = '<div id="test">Hello <span>world!</span></div>';

The result must be:
Hello world!

Answer Source
var myContent = '<div id="test">Hello <span>world!</span></div>';


That results in hello world. Does that answer your question? for an example