javascript - Quick way to alert the values of all input elements in a form? -


i have form 10+ input elements in it... testing, i'd alert values... there quicker way this:

var f = document.getelementbyid('myform').getelementsbytagname("input"); alert(f[0].name + ' ' + f[0].value); alert(f[1].name + ' ' + f[1].value); alert(f[2].name + ' ' + f[2].value); ... , on... 

you'll want use for loop that.

var f = document.getelementbyid('myform').getelementsbytagname("input");  (var = 0; < f.length; i++)     alert(f[i].name + ' ' + f[i].value); 

if testing/debugging things, i'd recommend using browser's console. using chrome or firefox + firebug can call console.log method , drill down object. tends bit easier manage in opinion.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -