Siri: jQuery: this und $(this)

Beitrag lesen

Hallo,

bei Stackoverflow hab ich zum Thema "Difference between $(this) and this in jquery" folgende Aussage gefunden:

"this is the DOM object, whereas $(this) is the jQuery wrapper around same.

When using this, you can call DOM methods on it, but not jQuery methods. When using $(this), you can call jQuery methods on it, but not DOM methods."

Bei jQuery gibt es folgenden Beispielcode zum Thema Plugins:

  
(function( $ ) {  
   $.fn.showLinkLocation = function() {  
  
     this.filter( "a" ).each(function() {  
       var link = $( this );  
       link.append( " (" + link.attr( "href" ) + ")" );  
     });  
  
     return this;  
   };  
}( jQuery ));

filter("a") ist doch eine jQuery-Methode, oder? Wieso dann this und nicht $(this). Ebenso verstehe ich nicht, warum man this zurückgibt und nicht $(this). Kann mir das jemand erklären? Danke!

Viele Grüße
Siri