For reasons I won't go into here I have a page which has a table with
a variable amount of rows. Each row has a hidden, text, and select.
They all have the same name. I also have other selects on the page
with different names.

What I need to do is access only the selects, to be able to add and
remove options. So I need to know how many selects with the name "foo"
are on the page

I have tried this:

jQuery("select#foo")

which simply returns [Object object]. If I do this:

jQuery("select#foo").length

it returns 0 which is not true. When I load the page I have 2 selects
already. So if I do this:

jQuery("select#foo").text()

it returns white space. And

jQuery("select#foo").val()

returns undefined.

I have also tried stuff like

jQuery("select#foo[0]").val()

but nothing seems to work. Since uses can dynamically add rows to the
table (and with each one a hidden, text input and select) I need to 1)
know how many selects with a given id/name there are and 2) be able to
manipulate the values in each one.

How can I do this?

Thanks!

Reply via email to