Skip to content

Commit 422a454

Browse files
janusschmidtscottgonzalez
authored andcommitted
Basic Plugin Creation: Fix broken chaining
Closes jquerygh-399
1 parent f3da3d8 commit 422a454

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

page/plugins/basic-plugin-creation.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,13 @@ Here's an example of a small plugin using some of the techniques we've discussed
187187
188188
$.fn.showLinkLocation = function() {
189189
190-
return this.filter( "a" ).each(function() {
190+
this.filter( "a" ).each(function() {
191191
var link = $( this );
192192
link.append( " (" + link.attr( "href" ) + ")" );
193193
});
194194
195+
return this;
196+
195197
};
196198
197199
}( jQuery ));
@@ -217,10 +219,12 @@ Our plugin can be optimized though:
217219
218220
$.fn.showLinkLocation = function() {
219221
220-
return this.filter( "a" ).append(function() {
222+
this.filter( "a" ).append(function() {
221223
return " (" + this.href + ")";
222224
});
223225
226+
return this;
227+
224228
};
225229
226230
}( jQuery ));

0 commit comments

Comments
 (0)