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" />
<input id="url" type="text" />
<input id="sub" type="button" value="Make Your Own" />
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() {
if($('#url').val() !== "") {
$('#thisThing').css("background", "url("+ $('#url').val());
};
var color = $(this).attr('name');
$('#thisThing').removeClass();
$('#thisThing').addClass(color);
});
});