Sign In/My Account | View Cart  
advertisement

Article:
 jQuery and XML
Subject: $(this).get(0)
Date: 2007-10-16 13:01:12
From: Uche Ogbuji
Response to: $(this).get(0)

That's not correct, at least with jQuery 1.2.1 on FF 2. this.namespaceURI will give you an attribute error, because this is not a DOM node. It's a jQuery wrapper. The get method unwraps it.


And yes, I tested both ways for the article.


No Previous Message Previous Message Move up to Parent Message Up Next Message No Next Message


Titles Only Titles Only Newest First
  • $(this).get(0)
    2007-10-19 17:06:07 aristotle

    Ah. Well, if this is a jQuery object, then this.get(0) should work as well.


    The docs explicitly say about each (http://docs.jquery.com/Core/each) that “every time the passed-in function is executed (which is once for every element matched) the this keyword points to the specific DOM element” though, and it has in practice behaved that way for me. Very odd that you get different behaviour. *headscratch*


Sponsored By: