I am trying to figure out how to convert a user entered string which contains an image url, to display as an image by adding the img attr.
Here is what i have been playing with:
$(".message_content").each(function() {
var text = $(this).text();
text = text.replace("http://www.example.org/myimage.jpg", "<img src="http://www.example.org/myimage.jpg"> ");
$(this).text(text);
});
Although this doesnt work, anybody tried anything similar?