In ie8 if elements don\'t \'repaint\' with the associated css when you change the classname, how can you force the browser to refresh and not kill ie8 performance?
This
I had a lot of difficulty and tried everything to no avail...until I tried this for IE8
function toggleCheck(name) {
el = document.getElementById(name);
if( hasClass(el, 'checked') ) {
el.className = el.className.replace(/checked/,'unchecked');
} else if( hasClass(el, 'unchecked') ) {
el.className = el.className.replace(/unchecked/,'checked');
}
document.body.className = document.body.className;
}
function hasClass(element, cls) {
return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1;
}
And now my CSS changes for my checkboxes work beautifully for IE8, Chrome, and Firefox!