DEV Community

Govind Prasad Gupta
Govind Prasad Gupta

Posted on

Answer: How do you read CSS rule values with JavaScript?

function getStyle(cssClass){
    let result = '';
    let styleSheets = document.styleSheets;
    for (let i = 0, j = styleSheets.length; i < j; i++) {
        let classes = styleSheets[i].cssRules;
        if (classes && classes.length) {
            for (let x = 0, y = classes.length; x < y; x++) {
                let selectorText =
…





https://codesandbox.io/s/set-node-inline-style-fphedg

Top comments (0)