5

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

mikul
  • 526
  • 6
  • 14

1 Answers1

2

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!

Emre Erkan
  • 8,433
  • 3
  • 48
  • 53
  • 1
    The jQuery `css` function has also implemented this function, including more "hooks" to deal with browser inconsistencies. – Rob W Dec 24 '11 at 18:12