JSFiddle - React, Tailwind, and code Playground
HTML
<nav>
<a href="http://www.5alarmint.com">My Portfolio Site</a>
<a href="http://fiddle.jshell.net/PqCuc/3/show/light/">JSFIDDLE</a>
<a href="http://www.google.com">Google</a>
</nav>
CSS
.active{color:#ff0000;}
JavaScript
function stripSlash(str) {
if(str[str.length - 1] == '/') {
return str.substr(0, str.length - 1);
}
return str;
}
$('nav a').each(function(){
if(stripSlash($(this).attr('href')) == stripSlash(document.URL)){
$(this).addClass('active');
}
});