How would I go about hiding all HTML tags using jquery. Not removing but hiding. Would I have to individually specify each tag or is there a more robust/scalable solution?
Example String:
My name is <b>Joe</b> and I like <span style="color:red;">long walks</span> on the <i>beach</i>.
Result
My name is and I like on the .
You can hide all the child elements of a specific parent.
Since the descendants of hidden elements will not be shown anyway, there is no need to iterate over all of them with
find("*"):Or, alternatively, as gdoron suggests:
The above might be faster since it uses a pure CSS selector.