Reputation: 217
In my javascript code, i am trying to access a child's class which is present in external style sheet. Using
window.getComputedStyle("className", null).getPropertyValue("color")
throws an Unhandled error: WRONG_ARGUMENTS_ERR
. Do anyone see any issue in this?
I want to access the class property, which is present in external stylesheet.
Thanks
Upvotes: 3
Views: 204
Reputation: 14983
i think you'll need to feed getComputedStyle()
a DOM-Element, not just the ClassName
maybe try:
var el = document.getElementsByClassName("className")[0];
window.getComputedStyle(el, null).getPropertyValue("color");
Upvotes: 2