Dynamically split div does not have CSS styles in the DOM in IE8

advertisements

Using jQuery in IE8, I'm creating a div with a class (ex. <div class="className"></div>). This class has several CSS styles on it, including background, margin, and border. When debugging the javascript in IE9 (running as IE8), and inspecting the element, all of the currentStyles have the default values, instead of the values from the CSS. So, when I try to get the margin, it comes back as being set to auto even though the CSS puts it at 10px.

The script has no errors and it does work as expected in Firefox, Chrome, and IE9. Any thoughts?


There is a refresh button in Developer tools. That reloads the DOM tree without reloading the page.

If you do DOM changes with JavaScript, they are not reflected in the MSIE developer tools, unless you klick the refresh button. See image below: