You are new to the community and asked for very basic example. From next time onwards, please show us your work before seeking help.
var checkbox = document.querySelector('.js-disableCurrentAddress');
var currentAddr = document.querySelector('.js-currentAddress');
checkbox.addEventListener('change', handleDisable);
function handleDisable() {
if (checkbox.checked) {
currentAddr.setAttribute("disabled", "disabled");
} else {
currentAddr.removeAttribute("disabled", "disabled");
}
}
<input type="text" class="js-currentAddress" placeholder="current">
<input type="text" class="js-permanentAddress" placeholder="permanent">
<label>
Disable current address
<input type="checkbox" class="js-disableCurrentAddress">
</label>
solved Using HTML and Javascript I want the solution [closed]