I’m currently trying to save some HTML (which comes from an XML file) in a variable, but somehow i get some strange errors. In addition to that, it seems that the browser tries to load the images used in that piece of HTML code, even if I don’t use it.
Here’s the code:
// Load the data from the XML node.
var description = $(this).find('description').text();
var descriptionWithTags = description.replace('<p>','');
descriptionWithTags = descriptionWithTags.replace('</p>','########');
// Remove HTML Tags and add the Line-Breaks
var convertedString = $(descriptionWithTags).text();
convertedString = convertedString.replace('########','<br /><br />');
console.log("E");
// Save it in an array.
contentRSS[articleCount] = convertedString;
Edit: If i remove the following line, it works again, but I don’t now why.
descriptionWithTags = descriptionWithTags.replace('<p>','');
You start with a text without HTML tags :
then you try to parse it as HTML :
This can’t work. You should probably use html in the first line :