browser that returns the white color, instead of the actual background
color... However, if you use the camelcase notation it will work even
in Firefox.
$("#mycheckbox").css("backgroundColor"); // works in all browsers
$("#mycheckbox").css("background-color"); // works in all browsers
except Firefox
This should be a good reason to allways use camelcase inside the css()
method.
***
I also did some analysis on the style object of the checkbox.
I set the background-color with this code:
$("#cb").css("background-color", "#fa0");
Here are the relevant properties of the style object for every
browser:
Firefox:
0 = background-color
backgroundColor = rgb(255, 170, 0)
cssText = background-color: rgb(255, 170, 0);
Internet Explorer:
cssText = BACKGROUND-COLOR: #fa0
backgroundColor = #fa0
Safari:
0 = background-color
cssText = background-color: rgb(255, 170, 0);
Chrome:
0 = background-color
cssText = background-color: rgb(255, 170, 0);
Opera:
background = #ffaa00
backgroundColor = #ffaa00
cssText = background-color: #ffaa00
No comments:
Post a Comment