UPDATE: I have discovered that the issue lies with Internet Explorer which alters the class attribute of an HTML element from:
"<img class="blah".." to "<img class=blah..".
This inconsistency only occurs in IE for me. It does not affect other attributes such as src or id quotation marks, making it quite frustrating!
I am utilizing JQuery to enhance the visual appearance of a website. Within my main div (updatableDiv), I convert each editable HTML element (such as p, i, b, etc.) into a textarea. Users can make changes and upon submission, the textareas are converted back into their original format using JQuery.
The Issue at Hand: When attempting to retrieve the HTML content from the div with the id updatableDiv, the obtained HTML is slightly altered, resulting in a variation in the displayed output. For instance, if there is an image positioned directly above a white box without any vertical space between them, after updating the HTML, a gap appears vertically between the image and the white box.
Initial HTML code (example from IE):
<img class="pageHeading" src="linksHeading.png" width="90%" alt=""/><div class="pageContent">
Upon retrieving the HTML using $("#updatableDiv").html(), the HTML now appears like this:
<IMG class=pageHeading alt="" src="linksHeading.png" width="90%">
<DIV class=pageContent>
Resulting in the introduction of a vertical gap.
Therefore, my primary concern is how to preserve the formatting of the HTML to avoid such issues when updating and retrieving the HTML content using JQuery's $("#updatableDiv").html()?