Replace a list of emoticons with their images
- by Damiano
Hello,
I have an array with:
emoticons = {
':-)' : 'smile1.gif',
':)' : 'smile2.gif',
':D' : 'smile3.gif'
}
then i have a variabile with the text.
var text = 'this is a simple test :)';
and a variable with the url of the website
var url = "http://www.domain.com/";
How to write a function that replace the symbols with their images?
The <img> tag result should be:
<img src="http://www.domain.com/simple2.gif" />
(I have to concatenate the url varible to the name of the image).
THank you very much!