You can also do: $('#Province').is('select')
-js
On 5/30/07, Gordon <[EMAIL PROTECTED]> wrote:
Selects don't have a type so returning undefined is the correct
behaviour. I'm assuming you either want to get the value of the
select or you want to identify the node type. If you want the value
then you'd use attr ('value'). If you want to identify the element
node type things get a little trickier. You could use $
('select#Province') with is garantueed to only ever return a select,
but if you're iterating over a collection of items that may include
the select then this is no good. I'm not sure if you can use browser
DOM functions directly on a jQuery object but if you can then nodeName
($('#Province')) should return "SELECT".
On May 30, 5:28 pm, [EMAIL PROTECTED] wrote:
> The following line returns 'select-one' in IE6 and 'undefined' in
> Firefox 2.0.0.3.
>
> $( "#Province" ).attr( "type" )
>
> <select name="Province" id="Province">
> <option>Ontario
> <option>Alberta
> <option>Nova Scotia
> </select>
>
> I get the same results in jQuery 1.1.2 and 1.1.3a releases.
>
> Is this is a bug?
>
> If I use document.getElementById("Province").type I get the 'select-one'
> value in Firefox.