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

Answers:

Answer

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!

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.