How can I remove the tag and keep the text in the element using RegExp?
I want to remove an element tag and keep the text inside the tag. I am using the replace function RegExp, but it removed everything: the tag and the text inside the tag.
I don't want this, I only want to remove the tag. Clear text, remove tags, I only want to present text.
var str = str.replace(/<.>[^.]*\/.>/, "");
I used this but there is a problem, it also removed the text inside it.
+1
a source to share
3 answers