How can I get the style of a div, that is being applied from stylesheets/style tags and ignore the element style programmatically?
e.g.
var alice = 'alice ' + $('.alice').css('color');
var boblice = 'alice ' + $('.bob').css('color');
var bob = 'bob ' + $('.bob').css('color');
$('#result').text(
alice + '\n' + bob
);
$('#expected').text(
boblice + '\n' + bob
);
var elem1 = document.getElementById("alice");
alicestyle = window.getComputedStyle(elem1, null);
console.log(alicestyle);
.alice {
color:green;
}
.bob {
color:green;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='alice' class="alice" style="color:red">
test
</div>
<div id = 'bob' class="bob">
test
</div>
result:
<div id="result">
</div>
expected:
<div id="expected">
</div>
getComputedStyle:
<div id="computed">
</div>