I have two checkboxes, like below:
<input type="checkbox" id="id" name="data[Noncompetitor][is_black][1]" value="1">
<input type="checkbox" id="id" name="data[Noncompetitor][is_black][2]" value="1">
Now, on a condition, I want to disable them using javascript.
Should work like this:
document.getElementById("id").setAttribute("disabled", "disabled");
Re-enable it like this:
document.getElementById("id").removeAttribute("disabled");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.