Jquery Function required to replace content in a String
<p>I have a textarea where users can type content and also include emoticon symbols like :) or ;)</p>

<p>When 'Sent' is pressed the textarea string needs to be parsed to convert any emoticon symbols into <code>&lt;img&gt;</code>'s for display.</p>

<p>I can easily generate a list of emoticons and there relevant image like:</p>

<pre><code> ':)' - '&lt;img src="/images/happy.jpg"/&gt;'
 ';)' - '&lt;img src="/images/wink.jpg"/&gt;'
</code></pre>

<p>I assume the above could be put into an associate array.</p>

<p>Can someone point me in the right direction to create an associate array of emoticon symbol's and html img tags and then parse a string to replace the matching symbols with the html img tags?</p>

<p>Also out of interest is there a better way to do this?</p>

<p>thankyou</p>
