JSFiddle - React, Tailwind, and code Playground

by BenjaminRay

HTML

<input type="checkbox" id="enabledisable" name="enabledisable" value="Add Function">
<label for="enabledisable">Add Function</label>
<table id="table">
    <tr>
        <td>Regular Cell</td>
        <td class="js-clickable">Clickable Cell</td>
        <td>Regular Cell</td>
    </tr>
</table>

CSS

td {
    padding: 10px;
}

JavaScript

$(function () {
    $('#table').on('click', '.js-clickable', function (evt) {
        if ($('#enabledisable').is(':checked')) {
            // Handle click, as checkbox is checked
            alert('Checked, so we are doing something now...');
        } else {
            // Ignore click
        }
    });
});