I have a set of check boxes with Id's user1,user2 and so on and also set of combo boxes with Id's usersel1,usersel2 and so on in a dialog. When a check box is checked (say suppose with Id user1) then corresponding combo box must be activated(i.e combo box with Id usersel1). I have the following code and isn't working. How do i achieve this behavior?
for(var g=0;g<userlist.length;g++) //userlist.length give no of users
b2 = (goog.dom.getElement('usersel'+(g+1))); //gets combo box
//listening if check box is clicked
goog.events.listen(goog.dom.getElement('user'+(g+1)),
goog.events.EventType.CLICK,
function(e) {
b2.disabled = (false); // trying to enable corresponding combo box
});
The problem with above piece of code is that any check box is clicked only the last combo box gets activated.