JSFiddle - React, Tailwind, and code Playground
HTML
<h2>a tags matching the selection are being given a black bg</h2>
<a href="">"" href</a><br />
<a href="test">test href</a><br />
<a href="#"># href</a><br />
<a href="http://www.google.com" >google href attr</a><br />
CSS
.selected {
background: black;
color: white;
}
a {
color: blue;
padding: 4px;
display: inline-block;
margin: 3px;
}
JavaScript
jQuery("a[href]").filter("[href!='#']").each(function() {
jQuery(this).addClass("selected");
});