JSFiddle - React, Tailwind, and code Playground
by Addy Osmani
HTML
<div id="myitem">test</div>
CSS
#myitem { background-color:green; width:200px; height:200px}
#myitem:hover { background-color:red}
JavaScript
function getStyle (selector){
var re = new RegExp('(^|,)\\s*'+selector.toLowerCase()+'\\s*(,|$)');
var style = "";
$.each ($.makeArray(document.styleSheets), function(){
$.each (this.cssRules || this.rules, function(){
if (re.test(this.selectorText)) style += this.style.cssText + ';';
});
});
return style;
}
var temp = getStyle('#myitem:hover');
alert("css= "+temp);
var myColor = $('#myitem:hover').css('background-color');
alert(myColor);