Skip to content

Instantly share code, notes, and snippets.

@Nikolasgrizli
Created August 27, 2019 23:51
Show Gist options
  • Save Nikolasgrizli/f19d5f3d349feaef72b33dd581401b09 to your computer and use it in GitHub Desktop.
Save Nikolasgrizli/f19d5f3d349feaef72b33dd581401b09 to your computer and use it in GitHub Desktop.
Get exact value property (height example)
// if value in html
var height = $("element").get(0).style.height;
// if value in css
var rules = document.styleSheets[0].rules || document.styleSheets[0].cssRules;
for(var i=0; i < rules.length; i++) {
var rule = rules[i];
if (rule.selectorText.toLowerCase() == "element") {
var width = rule.style.getPropertyValue("height");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment