What I'm trying to do is to force this code to replace a part of the text that is ':•:' if he finds it on the page in a paragraph, with an image.
$("p").each(function () {
if ($(this).children().length == 0) {
$(this).text($(this).text().replace(':•:').html('<img src = "http://lilpic.png" />'));
}
});
But what I ended up with was that the text was indeed replaced, but not with the image as it is, but with just ugly raw HTML-code of it. What am I doing wrong? What I need in the end is just a code, that would change the marker ':•:' into a picture.