[jQuery] Re: Plugin development: Defaults & options: Questions?

2009-12-22 Thread Micky Hulse
Hi Scott! Thanks again for the help. I really appreciate it. :) > Looks right to me.  One alternative, which wouldn't break the chain if > target is not supplied properly, would be this: Ah, right. That is a smart solution. Thanks for the clarification! > I don't think it's overkill for your in

[jQuery] Re: Plugin development: Defaults & options: Questions?

2009-12-21 Thread Scott Sauyet
On Dec 21, 4:06 pm, Micky Hulse wrote: > Ok, so how does this look: > > (function($) { >         $.fn.myFunction = function(id) { >                 var $target = $('#' + id); >                 if($target.length > 0) { >                         return this.each(function() { >                      

[jQuery] Re: Plugin development: Defaults & options: Questions?

2009-12-21 Thread Micky Hulse
Hi Scott! Many thanks for your pro help and super fast reply! I really appreciate it. :) > There are a few options.  I often add an optional errorHandler > .. > Then your code can check that the required parameter is there. Oooh, that is nice! Cool technique! Thanks for sharing. :) > Alterna

[jQuery] Re: Plugin development: Defaults & options: Questions?

2009-12-21 Thread Scott Sauyet
On Dec 21, 3:08 pm, Micky Hulse wrote: > But, I guess I am wondering what the best way to handle javascript > error checking for required options? There are a few options. I often add an optional errorHandler function; my defaults would include: errorHandler: function(status, message) {} a