Couldn't you do:
if(!!$(ele).attr('disabled')) { //stuff } -- dz On Thu, Aug 27, 2009 at 1:15 PM, William Chang<diehardb...@gmail.com> wrote: > > Hey Matt, > I understand now. Thanks! > > So, how do you avoid using attr() when you need to check for an > attribute in the element? And, getting the value from an attribute? > > Sincerely, > William Chang > http://www.williamchang.org > http://www.babybluebox.com > > On Aug 27, 12:24 pm, Matt Kruse <m...@thekrusefamily.com> wrote: >> On Aug 27, 11:16 am, William Chang <diehardb...@gmail.com> wrote: >> >> > I don't think the attribute is defined by default, after I did some >> > more testing. I find the value return is not consistent between >> > Firefox and IE8 (and probably previous versions of Microsoft Internet >> > Explorer). >> >> First of all, the attr() function has had problems for a long time. >> Don't use it. >> >> Properties and attributes are different things, and jQuery confuses >> the two in unpredictable ways. Although you are requesting the >> attribute value, it really returns the property value. Read through >> the source of attr() and it becomes pretty clear what is happening. >> >> The difference you are seeing is due to the (name in elem) check. IE >> is returning true, causing the property [false] to be returned. FF is >> returning false, causing getAttribute() to be called, which returns >> null, which gets "normalized" to undefined. >> >> Depending on what type of element you are calling this on, the results >> may be the same (input, for example), or different (img, for example). >> >> It's always best to avoid using attr() because of it's poor >> implementation. IMO. >> >> Matt Kruse > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---