I have a group of radio buttons like so:
<input TYPE=radio NAME=Array Value=8> Blue<br>
<input TYPE=radio NAME=Array Value=9> Orange<br>
<input TYPE=radio NAME=Array Value=10> Yellow<br>
<input TYPE=radio NAME=Array Value=11> Ruby
I want to add an onclick event dynamically, I tried with this approach:
var radios = document.getElementsByName("Array");
for(var i=0; i<radios.length; i++) {
radios[i].onclick = finish();
}
Instead of adding the onclick event, it just fires the function four times when the page loads. Also tried radios[i].onclick = “finish();”; but to no avail. Any ideas on the matter or reasons what I’m doing wrong?