[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

[jQuery] Re: Plugin Development

2009-04-13 Thread Spot
Anyone else able to shed some light on this? Spot wrote: Nathan, Ok, I am aware of the base use of each() (been coding in PHP for about eight years), but I cannot see how it is viable in this case. Making a long story short... This plug-in is a selector(auto-completer). To be more specifi

[jQuery] Re: Plugin Development

2009-04-07 Thread Spot
Nathan, Ok, I am aware of the base use of each() (been coding in PHP for about eight years), but I cannot see how it is viable in this case. Making a long story short... This plug-in is a selector(auto-completer). To be more specific, it is several selectors. I have a specific plugin for ea

[jQuery] Re: Plugin Development

2009-04-07 Thread Nathan
Yeah, Copy/paste gets ya no where for sure. For each() you should check out: http://docs.jquery.com/Core/each Which states: "Execute a function within the context of every matched element" >From my previous example, "this.each()" is the same as saying: $('#divNameHere').each(); So that runs y

[jQuery] Re: Plugin Development

2009-04-07 Thread Spot
Nathan, first off, thank you for responding. I understand about passing the obj as scope. That makes perfect sense. However I am a little confused as to the purpose of returning this.each. What is the goal there? I find it better to understand why something works, as opposed to just copy/pa

[jQuery] Re: Plugin Development

2009-04-07 Thread Nathan
To do this you need to have "return this.each" and optionally change the instance of "this" which is the name of the object you are apply the plugin to, to "obj" using "var obj = $(this);". Then when you call a selector, you'll need to add "$('#nav a', obj)" note the ", obj". This will keep it

[jQuery] Re: plugin development

2007-04-17 Thread ing. Salvatore FUSTO
http://www-128.ibm.com/developerworks/library/x-ajaxjquery.html - Original Message - From: "phpLord" <[EMAIL PROTECTED]> To: Sent: Tuesday, April 17, 2007 7:55 PM Subject: [jQuery] plugin development Hi; do you know any guide about plugin development except the documentation wiki

[jQuery] Re: plugin development

2007-04-17 Thread Remy Sharp
I've got a tutorial here that might help: http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/ It's simple in that it's a reusable plugin, but it doesn't have any logic outside of the 'each' loop - which is where you can really beef up the power of your plugin. I'm sure there will be