JSFiddle - React, Tailwind, and code Playground

HTML

<span class="rightDiv">Here's some text</span>

CSS

.rightDiv {
    background-color: red; 
    padding: 10px; 
    cursor: pointer;   
    position: absolute;   
    left: 50px;                
}

JavaScript

var el = false;
$(document).ready(function() {
    $(".rightDiv").click(function() {
        $(this).stop(true).animate({left: (el ? 50 : 150) + 'px'});
        el = !el;
    });
});