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 r
Something else must be wrong there, because there has never been a
problem with jQuery being able to identify select elements. They are
identified by tagName, just like any other element --$('select') -- so
there is no need for a :select pseudo class. And of course you should
be able to use
Even if I add an id to the select element and try to select by Id, I
cannot get a reference to it:
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 g
$("select[name=yearFrom]")
doesn't work
$(":select[name=yearFrom]");
doesn't work
$(":input [name=yearFrom]")
doesn't work
$("input[name=yearFrom]");
doesn't work
There is no :select element in the jQuery docs, only an :input
element. There should be a way to select select elements...
On Apr 18,
> Is it impossible in jQuery to select an element as I do here (var
> yearFrom=$(":input[type=select][name=yearFrom]");)?
>
> Marc
Yes, i think you should do it like this instead $("select
[name=yearFrom]");
jQuery will look for an element which actually has a type="select"
attribute.
Load data
5 matches
Mail list logo