remove html tags from string javascript

To strip out all the HTML tags from a string there are lots of procedures in JavaScript. As asked for your particular string (to remove

elements): item = item.replace(/<\/?p>/g,''); // will globally find

and

only As a result, there is no standard method for Firstly, create a function named stripTags() with html as its argument. Using regular expression. In the first method, we will use the Regular Expression to 1. Here, parseFromString() method removes the HTML tags from the string unStripped. Match the special characters with a RegEx pattern and replace them with empty quotes. We are calling replace () method and passing regex and empty string as parameters.