JSFiddle - React, Tailwind, and code Playground
HTML
<div id="thisThing"></div>
<input id="yellow" type="button" name="yellow" value="yellow" />
<input id="red" type="button" name="red" value="red" />
<input id="blue" type="button" name="blue" value="blue" />
CSS
#thisThing {
width:200px;
height:200px;
}
.yellow {
background:url(https://pbs.twimg.com/profile_images/378800000416517983/5a9f8965be087ed821d5479936ee384f.jpeg);
}
.blue {
background:url(https://pbs.twimg.com/profile_images/3526723885/53af4042dce2b705beebd2f80e42140f.png);
}
.red {
background:url(https://pbs.twimg.com/profile_images/3379734156/14919b9a839a39d203ede8bd85753dc8.png);
}
JavaScript
$(function() {
$('input').on('click', function() {
var color = $(this).attr('name');
$('#thisThing').removeClass();
$('#thisThing').addClass(color);
});
});