I'm at my wits end, and it's probably something really simple.. But I've got basically this code:
var menuitem = document.getElementById('mymenuitem');
alert(menuitem);
alert(varImChecking == null);
menuitem.setAttribute('disabled', (varImChecking == null) ? 'true' : 'false');
It should be disabling the 'mymenuitem' menu item, but has no effect. When run, the alerts say '[Object XulElement]' followed by 'true'. I know the getElementById is selecting the correct menuitem element because onclick bindings to the menuitem variable work.
Some alternatives I've tried:
menuitem.setAttribute('disabled', (varImChecking == null));
menuitem.disabled = (varImChecking == null);
So why isn't the setAttribute having any effect? It doesn't even gray out the menu item. Is there another way I'm supposed to do this?
Edit: Forgot to mention, no warnings or errors show up in the console.