Agregar clase en la función JavaScript OnClick
document.addEventListener('click', function handleClick(event) {
console.log('user clicked: ', event.target);
event.target.classList.add('bg-yellow');
});
Graceful Goosander