Solution
You can use
Regex
for this.
var imgRegex = new RegExp("<img[^>]*?>", "g");
This
Regex
matches the
image
tags.
After matching, it is just a matter of replacing matched string with blank.
str.replace(str.match(imgRegex), "");
Demo
[Demo] Regex to Match Image tags[
^]
You can see that
alert
is showing the
string
without the
image
tag (only the
div
).