Reply
Thu 11 Feb, 2016 01:50 pm
I'm trying to create a series of checkboxes designed to enable/disable their partner input text boxes. I'm not sure why but the if statements are not functioning properly and either they don't fire or they both fire based on as many changes as i've tried. Any help is greatly appreciated. Here is the code:
function disable(elem) {
var obj = document.getElementById(elem);
status = obj.disabled;
console.log(status);
if (status = true) {
console.log("test");
obj.disabled = false;
obj.style.backgroundColor = "white";
}
if (status = false) {
console.log("test2");
obj.disabled = true;
obj.style.backgroundColor = "bfbfbf";
}
}