I have a situation where when a user selects a checkbox it is supposed to disable an input field. I wrote the following code that works wonderfully in all other browsers except IE which I didn't know was most important for the client.
let input = document.querySelector("input");
let button = document.querySelector(".checkbox");
button.addEventListener("click", function() {
input.toggleAttribute("disabled");
});
Can someone help me with something that will also work in IE? Much appreciated.
For IE you need to use setAttribute and removeAttribute since toggle is not supported.