2👍
✅
Here you have an example:
$(document).ready(function() {
action();
$(".disabler").on("change", action);
});
function action() {
var checked = $(".disabler").prop("checked");
if (checked) {
$(".showable").removeClass("hidden");
} else {
$(".showable").addClass("hidden");
}
}
.hidden {
display: none;
}
.form{
border: 1px solid black;
background-color: #aaa;
padding: 10px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
Show form
<input class="disabler" type="checkbox">
<div class="showable">
<h2>Form</h2>
<form class="form">
Name <input type="text">
</form>
</div>
Source:stackexchange.com