Is there a way to change an attribute of a CSS class using javascript?
The key is to define extra rules for additional classes and add these classes to the elements rather than to rewrite the rules for a given style rule.
JS
function changeCSS() {
var selects = document.getElementsByTagName("select");
for(var i =0, il = selects.length;i
CSS
.fool select.hidden, select.hidden {
display: none;
}
Or for a really efficient method (but which might need a few more specific style rules too)
JS
function changeCSS() {
document.getElementsByTagName("body")[0].className += " hideAllSelects"
}
CSS
body.hideAllSelects select {
display: none;
}