JSFiddle - React, Tailwind, and code Playground

HTML

Click the checkbox to see it work.<br><br>

<input type='checkbox' id='theID' value='somevalue' />

JavaScript

var $theCheckbox = $('#theID');


$('body').click(function() {
    if( $theCheckbox.is(':checked') ) {
        var checked = $theCheckbox.val();
    }
    alert(checked);
});