With... <select name='foo'><option value='bar1'>bar1</option></select> <select name='foo'><option value='bar2'>bar2</option></select>
....try... var selects = $('select[name=foo]'); See the Attribute Filters, under Selectors in the API Reference. (If you have non-unique ids for elements on your page, do not rely on selecting them by $('#id')!) syg6-2 wrote: > > > 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! > > > -- View this message in context: http://www.nabble.com/multiple-selects%2C-hiddens-and-text-inputs-with-same-name-tf4576679s27240.html#a13068738 Sent from the jQuery General Discussion mailing list archive at Nabble.com.