here is my code. I can't make the alert works.
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);
If I do the top alert(I comment already) it works. If I alert chooseObject[i].value in the for loop, its fine. But if I do with array, it failed. Could someone help me?
alert(hobbyArray)?alert(hobbyArray.join(', '));