JSFiddle - React, Tailwind, and code Playground

HTML

<span class="my-class">Animated color text</span>

CSS

.my-class {
    color: blue;
}

.highlighted {
    color: red;
}

JavaScript

var $element = $('.my-class').addClass('highlighted');
var colorToAnimate = $element.css('color');

$element.removeClass('highlighted');

alert(colorToAnimate);