JSFiddle - React, Tailwind, and code Playground

by peterbenoit

HTML

<form><input type="checkbox" id="cb1" />select all/none<br /><input type="checkbox" id="cb2" />cb2<br /><input type="checkbox" id="cb3" />cb3<br /><input type="checkbox" id="cb4" />cb4<br /><input type="checkbox" id="cb5" />cb5</form>

JavaScript

$('#cb1').click(function() { 
$(this).parents().find(':checkbox').attr('checked', this.checked);
});