JSFiddle - React, Tailwind, and code Playground

HTML

<input type="button" id="btn" value="click me" style="background-color:red" />

JavaScript

$(document).ready(function() {
    $("#btn").click(function() {
        if ($(this).css('background-color') == 'red') {
           alert("test");
        } else {
           alert($(this).css('background-color'));
        }
    });
});