Why does javascript .replace not work on this array key?
<p>here I am adding the text of each '. cmsCategories' div to item_array, but then .replace() won't work on the item_array keys. How can I fix this? (after this I'll write the new contents back into the div). Any help would be awesome!</p>

<p><a href="http://jsfiddle.net/QKHJJ/1/" rel="nofollow">http://jsfiddle.net/QKHJJ/1/</a></p>

<p>Javascript:</p>

<pre><code>$(document).ready(function() {

var item_array=new Array();

$("[class=' cmsCategories']").each(function(i, obj) {
item_array.push(obj.innerHTML);
});

item_array[0].replace("icon_dog", "&lt;img src='img/icon_dog.png' alt='icon_dog' /&gt;"); 
item_array[0].replace("icon_cat", "&lt;img src='img/icon_cat.png' alt='icon_cat' /&gt;"); 

alert(item_array[0]);


});
</code></pre>

<p>HTML:</p>

<pre><code>&lt;ul class="cmsSmartListResults"&gt;
  &lt;li&gt;
    &lt;div class=" cmsCategories"&gt;icon_cat, apple, icon_dog, pear, banana&lt;/div&gt;
    &lt;a href="" class=" cmsPageLink"&gt;&lt;/a&gt;
    &lt;div class=" cmsDescription"&gt;&lt;/div&gt;
    &lt;div class=" cmsFileSize"&gt;&lt;/div&gt;
    &lt;a class=" cmsMoreLink"&gt;&lt;/a&gt;
&lt;/li&gt;
  &lt;li&gt;
&lt;div class=" cmsCategories"&gt;apple, icon_dog&lt;/div&gt;
&lt;a href="" class=" cmsPageLink"&gt;&lt;/a&gt;
&lt;div class=" cmsDescription"&gt;&lt;/div&gt;
&lt;div class=" cmsFileSize"&gt;&lt;/div&gt;
&lt;a class=" cmsMoreLink"&gt;&lt;/a&gt;
&lt;/li&gt;
  &lt;li&gt;
    &lt;div class=" cmsCategories"&gt;pear, banana&lt;/div&gt;
    &lt;a href="" class=" cmsPageLink"&gt;&lt;/a&gt;
    &lt;div class=" cmsDescription"&gt;&lt;/div&gt;
    &lt;div class=" cmsFileSize"&gt;&lt;/div&gt;
    &lt;a class=" cmsMoreLink"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
</code></pre>
