1

In IE 7, my sample static HTML and CSS correctly result in a horizontal and spaced set of div tags:

JSFiddle, Sample #1

But as soon as IE7 is asked to the same thing, with javascript modifying the "class" of the elements, it completely loses horizontal formatting:

JSFiddle, Sample #2

This second example generates the HTML, and updates it with a timer, but it is identical HTML.

I speculate this has something to do with having more than one class associated with the div elements (class="count-digit digit4"), and the fact that I'm updating the second of those two classes dynamically. I figure IE7 just gives up. Is that the real issue? And regardless, what would be the proper way to fix this - so that dynamic updates work correctly?

Brent Arias
  • 29,277
  • 40
  • 133
  • 234

1 Answers1

1

Try using element.setAttribute("className", "your-classname-here"); "Class" is a reserved word in ECMAscript, so they had to go with "className" instead (I'm guessing).

There's more info on SO here: why is class a reserved word in JavaScript?

Community
  • 1
  • 1
chprpipr
  • 2,039
  • 16
  • 17