JSFiddle - React, Tailwind, and code Playground

by Divine Chef

HTML

<div id="imgCont"></div><P>


<input type="radio" id="imgBtn" onclick="ClickMe();">Click Me

CSS

#imgCont {
	background-image: url('http://upload.wikimedia.org/wikipedia/commons/1/1b/Square_200x200.png');
	background-repeat: no-repeat;
	width: 200px;
	height: 200px;
}

JavaScript

function ClickMe () {
  if (document.getElementById("imgBtn").checked == true) {

  document.getElementById("imgCont").style.backgroundImage="url(http://www.bizreport.com/2011/02/03/android-logo-200x200.jpg)"
  }
  
  }