JSFiddle - React, Tailwind, and code Playground

by rajaadil

HTML

<div>
    <div><input type="checkbox" class="foo"> Checkbox</div>
    <div><input type="checkbox" class="foo"> Checkbox</div>
    <div><input type="checkbox" class="foo"> Checkbox</div>
    <div><input type="checkbox" class="foo"> Checkbox</div>
    <div><input type="checkbox" class="foo"> Checkbox</div>
    <div><input type="checkbox" class="foo"> Checkbox</div>
</div>

JavaScript

$('.foo').click(function(){

      $('.foo').attr('checked', false);
      $(this).attr('checked', true);

})