So I've already got this working but I'm hoping someone can help me optimize it.
I have a ton of XML data that I'm grabbing and do not have control over. One of the tags has markup in it and instead of using >, < and " it uses the HTML names. I've setup a really simple function to return the string with the proper elements so that I can write it to the page.
I'm just wondering, can my cleanFeedDescription() function be done a little cleaner and more optimized?
<script type="text/javascript">
var textString = '<img src="/media/filter/small/transfer/a0/46/21ca7da7/3569/1774/cf3f/82634fc4/img/4th_of_july_209.jpg" alt="" /> <p class="long-description"><span class="uploaded-date">Uploaded 2010-11-29 18:24:24</span><span class="uploaded-by">by gin_alvizo</span><span class="uploaded-to">part of Bull's-Eye Bold BBQ powered by ...</span></p>';
document.write(cleanFeedDescription(textString));
function cleanFeedDescription(descString) {
descString = descString.replace(/</g, '<');
descString = descString.replace(/>/g, '>');
descString = descString.replace(/"/g, '"');
return descString;
};
</script>