In this example Chrome sets the background red, firefox and IE do not.
Trying:
document.getElementById("firefoxDiv").style['backgroundColor'] = "Red";
and
document.getElementById("firefoxDiv").style['background-color'] = "Red";
I would much rather be able to use the same syntax used in external CSS
background-color
vs inline using javascript .style.backgroundColor =
Thanks for your help!
Note: NO jQuery please.
Use .style.setProperty(propertyName, value [, priority])
instead of an expando property.
Example:
document.getElementById("firefoxDiv").style.setProperty('background-color', 'red');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With