Reputation: 161
I have the below CSS line in one of my javascript function and it is working fine in other browsers except IE (Internet Explorer). The height of the element is like 4px when page loaded.
element.setAttribute('style', "height: 15px;")
Does anyone has the solution for this?
Upvotes: 0
Views: 58
Reputation: 944545
Some versions of IE (and newer versions of it when they are in backwards compatible rendering modes) have a horribly broken implementation of setAttribute
which just sets the property of the same name instead of setting the attribute.
Don't use it, and set the (correct) equivalent property directly instead.
element.style.height = "15px";
Upvotes: 1