im trying to replace text with an image using jquery or javascript. for example
<div id="log">
<p>this is a :) happy face</p>
<p>this is a :( sad face</p>
<p>these are :/ x( :P other faces</p>
</div>
ive attempted a few things but either i end up replacing the entire string or the browser does not render the image and instead displays the html
this is a <img src="happy.png"> face
this is for a chat application im messing with and im fairly new so if you can include some explanation in your code thatd help 🙂
Could look like (using jQuery):
Obivously this should get a little more sophisticated. I could imagine a lookup object where you link strings to images, for instance: