JSFiddle - React, Tailwind, and code Playground

HTML

<a class="directions-link" href="http://example.com/1.html">Should go to http://example.com/1.html plus the addition, result:  </a>

<a class="directions-link" href="http://example.com/2.html">Should go to http://example.com/2.html plus the addition, result:  </a>

CSS

a{
  display:block;
}

a:after{
  content:  attr(href);
  background: #ccc;
}

JavaScript

$("a.directions-link").attr("href", function(i, href) {
  return href + '?q=testing';
});