Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get all computed style of an element

i want to get all the style applyed to an element e.g like in chrome developer tool you have seen at top right section called "Computed Style" i want to get all the list is there any other simple way to get all the list and property

Source Code

i tried this javascript but it is not what i want, i have to manual write css property

i just want all the style applied to a element earlier or by default

like image 220
mikul Avatar asked Nov 05 '22 09:11

mikul


1 Answers

Try using this function (updated your jsFiddle);

function getComputedStyle(elm, style) {
    var computedStyle;
    if (typeof elm.currentStyle != "undefined") {
        computedStyle = elm.currentStyle;
    }
    else {
        computedStyle = document.defaultView.getComputedStyle(elm, null);
    }
    return computedStyle[style];
}

getComputedStyle() function is from I does Javascript!

like image 154
Emre Erkan Avatar answered Nov 14 '22 23:11

Emre Erkan