JSFiddle - React, Tailwind, and code Playground

by imsky

HTML

<div id="geography">
    <input type="checkbox" name="a">
    <input type="checkbox" name="b">
    <input type="checkbox" name="c">
    <input type="checkbox" name="d">
</div>

JavaScript

$(function() {
    var geoGroup = [];
    $("input:checkbox", "#geography").each(function() {
        var name = $(this).attr("name");
        if (name != null) {
            geoGroup[name] = $(this);
            geoGroup[name].click(function() {
                alert("hello");
            });
        }
    });
});