JSFiddle - React, Tailwind, and code Playground

by jomanlk

HTML

<a href=''>Link</a>
<a href=''>Link2</a>
<a href=''>Link3</a>

CSS

a {
    display:block;
    margin-bottom: 10px;
}

a.toggle {
    background: #AA0000;
}

JavaScript

$('a').click(function(){
    $('a.toggle').removeClass('toggle');
    $(this).addClass('toggle');
    //use $(this).toggleClass('toggle'); if you want it to toggle
    return false;
})