JSFiddle - React, Tailwind, and code Playground
by techiedelight
HTML
<!doctype html>
<html>
<body>
<p>Choose your vechicle:</p>
<div>
<input type="checkbox" id="bike" name="vechicle" value="bike">
<label for="bike">Bike</label>
</div>
<div>
<input type="checkbox" id="car" name="vechicle" value="car">
<label for="car">Car</label>
</div>
<div>
<input type="checkbox" id="select-all">
<label for="car">Select All</label>
</div>
</body>
</html>
CSS
p,
label {
font: 15px 'Exo 2', sans-serif;
}
input {
margin: 6px;
}
button {
margin-top: 10px;
padding: 2 2;
font: 15px 'Exo 2', sans-serif;
}
JavaScript
$(document).ready(function() {
$('#select-all').click(function() {
$('input[type="checkbox"]').prop('checked', this.checked);
})
});