JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<title></title>
</head>
<body>
<ul class="cmsSmartListResults">
<li>
<div class=" cmsCategories">icon_cat, apple, icon_dog, pear, banana</div>
<a href="" class=" cmsPageLink">The EU Cookie Law is round the corner. It’s time to take action.</a>
<div class=" cmsDescription">On May 26th 2011 a new EU law came into existence that requires the owners of websites to make changes to their sites. </div>
<div class=" cmsFileSize"></div>
<a class=" cmsMoreLink"></a>
</li>
<li>
<div class=" cmsCategories">apple, icon_dog</div>
<a href="" class=" cmsPageLink">The EU Cookie Law is round the corner. It’s time to take action.</a>
<div class=" cmsDescription">On May 26th 2011 a new EU law came into existence that requires the owners of websites to make changes to their sites. </div>
<div class=" cmsFileSize"></div>
<a class=" cmsMoreLink"></a>
</li>
<li>
<div class=" cmsCategories">pear, banana</div>
<a href="" class=" cmsPageLink">The EU Cookie Law is round the corner. It’s time to take action.</a>
<div class=" cmsDescription">On May 26th 2011 a new EU law came into existence that requires the owners of websites to make changes to their sites. </div>
<div class=" cmsFileSize"></div>
<a class=" cmsMoreLink"></a>
</li>
</ul>
</body>
</html>
JavaScript
$(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", "<img src='img/icon_dog.png' alt='icon_dog' />");
item_array[0].replace("icon_cat", "<img src='img/icon_cat.png' alt='icon_cat' />");
alert(item_array[0]);
});