I have no idea if there is a bug like that, but I use this kind of
construction to determine if an element is something I need it to be:
if ($('#element_id:radio').attr('id')=='element_id')

You can use many other : selectors to check if an element is something like
an input of a type or visible or animated, etc. I really wish there were
some jQuery functions for this. I don't see a better cross-browser way to do
this. Just selecting a non-existing element will return an Object just like
an existing element. .attr('id') on a non-existing element will return
'undefined' on some browsers and 'null' on others.

On Tue, Jan 13, 2009 at 9:15 PM, Scott Sharkey
<sshar...@linuxunlimited.com>wrote:

>
> Hi All,
>
> I'm stuck with Jquery 1.2.3 in a trac-based application.  I'm trying to get
> the type of a form control, to determine what mechanism I should use to set
> it's value (ie, text controls use .val(), checkboxes get .attr("checked",
> "checked") etc.).  When I fetch my list of controls, and loop through them
> with each, printing the value of .attr('type') on each... the text,
> checkbox, and textarea types work fine, but radio controls come up
> undefined. Is this a jquery bug?  Does anyone know if/when it was fixed?
>  Maybe I can port that patch back to 1.2.3 to solve my problem.
>
> Any other suggestions appreciated.
>
> -Scott
>

Reply via email to