I use .attr() to get the href attribute value, too. If you  
use .getAttribute(), IE6 and IE7 require a second argument to really,  
truly get the attribute: somelink.getAttribute('href', 2)

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Dec 14, 2009, at 10:05 AM, Scott Sauyet wrote:

> On Dec 13, 11:27 pm, Matt <m...@thekrusefamily.com> wrote:
>
> I'm not going to jump into these murky waters, but I want to follow up
> on this bit:
>
>> As it is now, I always recommend that attr() be avoided in code, and
>> if someone uses it in code I am looking at, I tell them to remove it.
>> It's too fragile and the logic that it is intending to code is not
>> well documented, so we can't depend on it. Luckily, it's easily coded
>> around.
>
> The only place I use attr extensively is when I want the href value of
> a link for further manipulation to unobtrusively convert non-JS
> functionality to JS functionality, most commonly when the href is for
> a document fragment.  Do you think it's bad practice to call
>
>    var myDiv=$(item.attr('href'));
>
> Obviously I could go down to getAttribute, but I've never had a
> problem using it like this.
>
>  -- Scott
>
> --
>
> You received this message because you are subscribed to the Google  
> Groups "jQuery Development" group.
> To post to this group, send email to jquery-...@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 
> .
>
>

--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@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.


Reply via email to