totally understand, thanks a lot
On 7月30日, 上午7時39分, Jules <jwira...@gmail.com> wrote: > From the jquery pluginhttp://docs.jquery.com/Plugins/Authoring > Your method must return the jQuery object, unless explicity noted > otherwise. > > $('input#btn').btnClick().css("background-color","blue") won't work > for your 1st case but works for the 2nd one. > > On Jul 30, 3:14 pm, "David .Wu" <chan1...@gmail.com> wrote: > > > > > I found these both work, so what is return for? > > > <script> > > $.fn.btnClick = function() { > > this.click(function() { > > alert('test'); > > }); > > > } > > > $('input#btn').btnClick(); > > </script> > > > <script> > > $.fn.btnClick = function() { > > return this.click(function() { > > alert('test'); > > }); > > > } > > > $('input#btn').btnClick(); > > </script>