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

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

alert($(myContent).text());

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

http://jsfiddle.net/D2tEf/ for an example

Leave a Comment