Hi,
I have multiple text input fields with the same name "name[]" and "age[]" which will return an array of information when I get document.getEle mentByName("nam e[]") (should I use getElementsByNa me("name[]") instead?)
For example,
name[] age[]
name[] age[]
name[] age[]
What I want to pull off is, when "name[]" goes onblur, a new set of empty fields will be added.
Then, when "age[]" goes onblur, I want to add two more text fields like above but with the value of the previous name[] copied to the value of the new name[]. Here is an example.
(john)name[] (14)age[]
(john)name[] ()age[]
In order to pull this off, I thought I have to somehow catch which position of the getElementByNam e("name[]") array it is and get that value and pass it to the onblur function in "age[]". How do I get that position? I'm assuming it's not item(). Is there a method that I could use?
Thank you.
I have multiple text input fields with the same name "name[]" and "age[]" which will return an array of information when I get document.getEle mentByName("nam e[]") (should I use getElementsByNa me("name[]") instead?)
For example,
name[] age[]
name[] age[]
name[] age[]
What I want to pull off is, when "name[]" goes onblur, a new set of empty fields will be added.
Then, when "age[]" goes onblur, I want to add two more text fields like above but with the value of the previous name[] copied to the value of the new name[]. Here is an example.
(john)name[] (14)age[]
(john)name[] ()age[]
In order to pull this off, I thought I have to somehow catch which position of the getElementByNam e("name[]") array it is and get that value and pass it to the onblur function in "age[]". How do I get that position? I'm assuming it's not item(). Is there a method that I could use?
Thank you.
Comment