I have a CSS file with the following code:
.datagrid table tbody td { color: #00496B; border-left: 1px solid
#E1EEF4; font-size: 16px ;font-weight: normal; }
Is there a way to use JavaScript to dynamically change the font size? The code below worked for all td elements, but how can I target a specific td under the .datagrid class? Any assistance would be greatly appreciated.
css('td', 'font-size', '9px');
function css(selector, property, value) {
for (var i=0; i<document.styleSheets.length;i++) {//Loop through all styles
//Try add rule
try { document.styleSheets[i].insertRule(selector+ ' {'+property+':'+value+'}', document.styleSheets[i].cssRules.length);
} catch(err) {try { document.styleSheets[i].addRule(selector, property+':'+value);} catch(err) {}}//IE
}
}