I have a string that contains HTML image elements that is stored in a var.
I want to remove the image elements from the string.
I have tried: var content =
You could load the text as a DOM element, then use jQuery to find all images and remove them. I generally try to treat XML (html in this case) as XML and not try to parse through the strings.
var element = $('My paragraph has images like this and this
');
element.find('img').remove();
newText = element.html();
console.log(newText);