JSFiddle - React, Tailwind, and code Playground

by demian85

HTML

<button>Button</button>

CSS

.hover {
    background-color: #333;
}
button {
    color: #fff;
    transition: all 0.1s ease;
}

JavaScript

var button = document.querySelector('button');

button.addEventListener('transitionend', function(e) {
    console.log(e);
    button.parentNode.removeChild(button);
});

button.classList.add('hover');
//button.clientWidth;

setTimeout(function() {
    //button.clientWidth;
    button.classList.remove('hover');
}, 50);

//window.getComputedStyle(button).backgroundColor;
//button.clientWidth;