'return true' is wrong, you need to return the 'wrapped set' to support 
chaining. The $().each method does return the 'wrapped set' and you can take 
advantage of this.

HTH
Morten


>-----Original Message-----
>From: Shane Riley [mailto:shanerileydoti...@gmail.com]
>Sent: Saturday, November 07, 2009 1:19 PM
>To: jQuery (English)
>Subject: [jQuery] Plugin Authoring Code Example Incorrect
>
>I created a jQuery plugin for the sake of learning the process and got
>it working no problem. In the plugin authoring docs it says that if
>you return true inside the each method, you can continue using jQuery
>chaining. However the code example above has the return this statement
>at the end of the plugin function rather than the each method. While
>quickly reading through this article after creating my plugin to
>ensure I was following best practices, I placed the return true in the
>same spot and my Javascript ceased to run. I tried logging in and
>editing the documentation, however it's locked. Just wanted to let
>everyone know of the mistake in the hopes someone on here has the
>ability to fix it.

Reply via email to