0
   

If checkbox/disable element problems

 
 
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";
}
}
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 371 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » If checkbox/disable element problems
Copyright © 2020 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 07/08/2020 at 07:49:45