Replace an entire tag with a string in a string
<p>I want to dynamically generate an input field based on the content of a paragraph containing some img tags (i.e. emoticons) and want to replace those images (the entire img tag) with an equivalend string (e.g. <strong>:)</strong>)</p>

<p>I tried the following function and it just does not work as expected.  (Even when I alert the data and use it for replacement)
Moreover, as I have many images I thought there would be a better way to find and replace the entire tag  in a string with jQuery. Any idea?</p>

<pre><code>TXT = convertSmiley(TXT);

var convertSmiley = function(data) {
        data = data.replace('&lt;img src="/images/smiley/happy.png" style="margin-bottom:-4px;" height="16" width="16"&gt;',':)'); // which does not seem to work

    return data;
}
</code></pre>
