elements is undefined in Javascript -


class = "text">

itemprop = "text">

Hello I'm getting the error "elements in Javascript" are undefined

  function ImportExcelMapping ( ) {Debugger; Var str = ""; (Var i = 0; i & lt; document.forms [0] .elements.length; i ++) {if (document.forms [0] .elements [i] .type == "hidden") {str + = '& Lt; Input type = \ "hidden \" name = "'+ element [i] .name +'" value = \ "'+ element [i] .value +'" & gt; '; }} // balance function}   

please help

 < Code> Elements [i] .name   

Where are the elements defined? Should it be document.forms [0] .elements [i] ?

Edit:

Since you still get confused, I'll add a little more detail. Hope that clears it

You need to either declare the element at the top of your function, such as:

  function ImportExcelMapping () {Debugger; Var str = ""; Var element = document.forms [0] .elements; // balance function}   

or

You need to change the line that is breaking it: < Pre> str + = '& lt; Input type = \ "hidden \" name = "'+ document.forms [0] .element [i] .name +'" value = \ "'+ document.forms [0] .element [i] .value +' "& Gt; ';

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -