JSFiddle - React, Tailwind, and code Playground

HTML

<input type="checkbox" value="123" />
<input type="button" class="x" value="show" /><br />
<input type="checkbox" value="456" checked />
<input type="button" class="x" value="show" />
<div id="dbg"></div>

JavaScript

$('.x').click(function() {
    var cb = $(this).prev('input:checkbox');
    $('#dbg').html('prop:' + cb.prop('checked') + '<br/>attr: ' + cb.attr('checked') + '<br/>:checked: ' + cb.is(':checked'));
});