JSFiddle - React, Tailwind, and code Playground
HTML
<a id="listitem0" href="http://google.com.au/">http://google.com.au/</a><br />
<a id="listitem1" href="http://stackoverflow.com/">http://stackoverflow.com/</a><br />
<a id="listitem2" href="http://kbbdigital.com.au/">http://kbbdigital.com.au/</a><br />
<a id="listitem3" href="http://netreach.com.au/">http://netreach.com.au/</a><br />
JavaScript
var link = document.getElementById('listitem0'); // Find element
// Cross Browser Solution to get the color of link
var getStyle = function(el, cssProperty){
if(typeof getComputedStyle !== 'undefined'){
return window.getComputedStyle(el, null).getPropertyValue(cssProperty);
} else {
// This will work in legacy browsers(IE8 and below)
return el.currentStyle[cssProperty];
}
}
var colorName = getStyle(link, 'color');
alert(colorName)