JSFiddle - React, Tailwind, and code Playground

HTML

<button>TEST</button>
<br>
<br>
<a href='#'>Change button's :active background-color to yellow</a>

CSS

button {
    background-color: blue;
    color: white;
    font-size: 200%;
}
button:active {
    background-color: red;
}

JavaScript

$('a').click(function () {
    event.preventDefault();
    
    $('button').on('mousedown mouseup', function (e) {
        $(this).css('background-color', e.type === 'mousedown' ? 'yellow' : '');
    });
});