JSFiddle - React, Tailwind, and code Playground
HTML
<input type="radio" name="check" value="enable" class="enableList">Enable
<input type="radio" name="check" value="disable" class="disableList">Disable
<div class="container">
<input type="checkbox" name="vehicle" value="Bike">I have a bike<br>
<input type="checkbox" name="vehicle" value="Car">I have a car
</div>
JavaScript
$(document).ready(function () {
$('.enableList').change(function () {
if ($(this).prop('checked') == true) {
$('.container').find('input:checkbox').each(function () {
alert ("enable check box");
});
}
});
$('.disableList').change(function () {
if ($(this).prop('checked') == true) {
$('.container').find('input:checkbox').each(function () {
alert("disable check box");
});
}
});
});