JSFiddle - React, Tailwind, and code Playground
HTML
<button>
Click me to turn the lights
</button>
<img src="http://myworldfacts.com/wp-content/uploads/2015/02/Horse-22.jpg" width="200">
CSS
body {
background: black;
}
img {
display: block;
margin-top: 50px;
}
JavaScript
var state = 'off';
$('button').click(function(){
if(state == 'off'){
// turn on the lights
$('body').css('background','white');
state = 'on';
}
else {
// turn off the lights
$('body').css('background','black');
state = 'off';
}
});