I'm trying to do something simple, there are 3 checkboxes and when I click on one I want the rest of them to be deselected. I also want to use a methods that I wrote for this purpose to be used on click.
when I do
myCheckBox.onclick = myMethod();
it runs only once when page loads and generally is not working properly
but when I do
myCheckBox.onclick = function(){
myMethod();
};
everything works as intended. Why does it work like this?