JSFiddle - React, Tailwind, and code Playground

by GCyrillus

HTML

<button class="toggle">button</button>

CSS

button {
    background:url(http://dummyimage.com/100x100) no-repeat 9999px 9999px  green;
    padding:5em;
}
.clicked {
    background-position:0 0;
    background-repeat:repeat;
}

JavaScript

$('.toggle').click(function () {
    $(this).toggleClass("clicked");
});