JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<input type="checkbox" checked="checked" />
</div>
CSS
div {
width: 100px;
height: 100px;
background-color: blue;
position: relative;
}
input {
display: block;
margin: auto;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
JavaScript
$(function() {
var $checkbox = $( ':checkbox' );
$('div') .click(function() {
$checkbox.prop( 'checked', $checkbox.prop( 'checked' ) );
})
});