JSFiddle - React, Tailwind, and code Playground
HTML
<p class="class">
<a href="http://hashcode.ru/" class="active">Ссылка 1</a>
<a href="http://hashcode.ru/3">Ссылка 2</a>
<a href="http://hashcode.ru/1">Ссылка 3</a>
<a href="http://hashcode.ru/2">Ссылка 4</a>
</p>
<button>Тыркалка</button>
<pre id="out"></pre>
CSS
a {
color: black;
}
.active {
color: green;
}
JavaScript
$('button').click(function() {
out.textContent = $('.class .active').last()
.next().addClass('active')
.attr('href');
});