S
Sam Kong
Hello,
There are 1 or more select elements with the same name in a form.
Let's say that the name of the select is 'select1' and the name of the
form is 'form1'.
If there's only one select I access it like form1.select1.
If there are more than one select, I access them like
form1.select1[index].
To check if there are more than one, I thought I can use
if (form1.select1.length) {
....
}
else {
....
}
But that doesn't work because if there's only one select,
form1.select1.length is a valid property which is the length of
options.
How do you usually handle this problem?
Thanks in advance.
Sam
There are 1 or more select elements with the same name in a form.
Let's say that the name of the select is 'select1' and the name of the
form is 'form1'.
If there's only one select I access it like form1.select1.
If there are more than one select, I access them like
form1.select1[index].
To check if there are more than one, I thought I can use
if (form1.select1.length) {
....
}
else {
....
}
But that doesn't work because if there's only one select,
form1.select1.length is a valid property which is the length of
options.
How do you usually handle this problem?
Thanks in advance.
Sam