JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html>
    <head>
        <title>Learning jQuery</title>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
    </head>
    <body>
        <div id="box" class="red">
        </div>
        <a href="#">Click Me</a>
    </body>
</html>

CSS

#box
{
    height: 200px;
    width: 200px;
    border: 1px solid #000;
}

.red
{
    background-color: red;
}

.yellow
{
    background-color: yellow;
}

a
{
    display: block;
}

JavaScript

$(function(){

    $('a').click(function(){
        if($('#box').hasClass('red'))
        {
            $('#box').removeClass('red').addClass('yellow');
        } else
        {
            $('#box').removeClass('yellow').addClass('red');
        }
    });

});