I was just wondering what the best way of looping through all the child elements of a form would be? My form contains both input and select elements.
At the moment I
pure JavaScript is not that difficult:
for(var i=0; i < form.elements.length; i++){ var e = form.elements[i]; console.log(e.name+"="+e.value); }
Note: because form.elements is a object for-in loop does not work as expected.
Answer found here (by Chris Pietschmann), documented here (W3S).