$('.messages').children().each(function() {
var textNode = $(this);
textNode.text(
textNode.text().replace("hi", "<img src='http://stupidknews.com/wp-content/uploads/2011/09/smiley-face.jpg' style='height:10px;'>")
);
});`
I have that, it replaces the text in all classes with messages
fine, but it replaces it with text, not with actual HTML.
How to make it work now!
You might need
html()
instead oftext();