JSFiddle - React, Tailwind, and code Playground
HTML
<script>
function selectAll() {
$('input[type=checkbox]').attr('checked', 'checked');
}
function unselectAll() {
$('input[type=checkbox]').attr('checked', false);
}
</script>
<input type="button" value="select all" onclick="selectAll()" />
<input type="button" value="unselect all" onclick="unselectAll()" />
JavaScript
$("body").append("<input type=checkbox>");