My code is here, but I can't seem to get the alert functioning properly.
var chooseObject = document.getElementsByTagName("input");
var objectLength = chooseObject.length;
var hobbyArray = [];
//hobbyArray("aaa");
//hobbyArray("bbb");
//alert(hobbyArray); This one works.
for(var i=0;i<=objectLength;i++){
if((chooseObject[i].type=="checkbox")&&(chooseObject[i].checked==true)){
//alert(chooseObject[i].value); This one works.
hobbyArray.push(chooseObject[i].value); }
}
alert(hobbyArray);
When I try the top alert (already commented out), it works. When I alert chooseObject[i].value in the for loop, it's fine. But when I do it with the array, it fails. Can someone assist me?