0

I have a page with several buttons(name SousMenu), all this buttons have onclick action.

Now I've create a main button to control all the button(idMenu). When the main button isn't checked, buttons aren't cheked.

if(document.getElementById(idMenu).checked == false) {  
    var x = document.getElementsByName(SousMenu);
    var i;
    for (i = 0; i < x.length; i++) {
        x[i].checked = false;
        x[i].onclick;
    }
}

Now I want to execute function for all buttons when the main button isn't checking, I've try something like x[i].onclick but it doesn't work..

Thanks for your help

Dima Tisnek
  • 11,241
  • 4
  • 68
  • 120

1 Answers1

1

onclick is a function, you have to call it using () :

x[i].onclick();

XCS
  • 27,244
  • 26
  • 101
  • 151