jQuery uses CSS3 syntax. To select a select element you use it's
tagname, "select", just like you would "div":

var yearfrom = $('select[name=yearFrom]')

You get the "yearfrom.options undefined" error because what you get
from the jQuery $() function is a jQuery object, not the DOM element
like returned from getElementById. You can access the element in the
object like in an array, yearfrom[0].options.

On Apr 18, 5:29 pm, marc <marc.at.comp...@gmail.com> wrote:
> Even if I add an id to the select element and try to select by Id, I
> cannot get a reference to it:
>
> <select name="yearFrom" id="yearFrom" style="visibility: hidden;"></
> select>
>
> yearfrom = $("#yearFrom")
>
> gives me the error "yearFrom.options is undefined" when I try to get
> to the yearfrom.options[0] array...
>
> Luckily document.getElementById("yearFrom") still works so I give up
> trying to use jQuery with select boxes ...

Reply via email to