Define Global Css Classes Using Javascript Or Jquery?
Is there a way to set the CSS of global classes using JavaScript or jQuery? That is, append .my_class { foo:bar } to the tag of the page?
Solution 1:
Pure javascript -
var style=document.createElement('style');
style.type='text/css';
if(style.styleSheet){
style.styleSheet.cssText='your css styles';
}else{
style.appendChild(document.createTextNode('your css styles'));
}
document.getElementsByTagName('head')[0].appendChild(style);
Post a Comment for "Define Global Css Classes Using Javascript Or Jquery?"