Javascript: Interation through form elements

var elem = document.getElementById(‘frmNameSearch’).elements;
str = ”;

for(var i = 0; i < elem.length; i++)

{

str += “Type: ” + elem[i].type + ” Name: ” + elem[i].name + “n”;

}
console.log(str);

Leave a Reply