JSFiddle - React, Tailwind, and code Playground

by painotpi

HTML

<input type='checkbox' name="confirm" />
<span>dasdasddasd</span>

CSS

span {
    width:50px;
    height: 50px;
    border: 1px solid black;
}

JavaScript

function enhance(Name) {
    alert("asd");
   var cb = $('input[name="'+Name+'"]');
    alert(cb.length);
}
$(cb).each(function () {
    $(this).wrap("<span></span>");
    if ($(this).is(':checked')) {
        $(this).parent().addClass("selected");
    }
    $(cb).click(function () {
        alert("asd");
        $(this).parent().toggleClass("selected");
    });
});
enhance("confirm");