[jQuery] Re: What am I missing from this plugin?

2007-07-24 Thread barophobia
On 7/23/07, Dan G. Switzer, II <[EMAIL PROTECTED]> wrote: > Making it be unobtrusive would be up the developer. The easy way to do this > would be for the user to "hide" the button via CSS and show it after attach > your plug-in. > > The developer could also make their button be able to automatica

[jQuery] Re: What am I missing from this plugin?

2007-07-23 Thread Dan G. Switzer, II
Chris, >> Also, I think I'd change the plug-in a bit. IMO, I would make more sense >to >> use like: >> >> $("#button").generate_password("#passwordField", iLength); >> >> That way you can attach the behavior to any element. Also, by using a >> selector for the field to update, you could update mu

[jQuery] Re: What am I missing from this plugin?

2007-07-23 Thread barophobia
On 7/18/07, Dan G. Switzer, II <[EMAIL PROTECTED]> wrote: > Also, I think I'd change the plug-in a bit. IMO, I would make more sense to > use like: > > $("#button").generate_password("#passwordField", iLength); > > That way you can attach the behavior to any element. Also, by using a > selector fo

[jQuery] Re: What am I missing from this plugin?

2007-07-23 Thread Stephan Beal
On Jul 23, 9:26 am, Klaus Hartl <[EMAIL PROTECTED]> wrote: > But that doesn't make any difference. It would still overwrite a > property named "target" of the jQuery object. Ah, i now see what you mean. Yes, that would of course be a danger. > You have to know jQuery very well to not accidently

[jQuery] Re: What am I missing from this plugin?

2007-07-23 Thread Klaus Hartl
Stephan Beal wrote: On Jul 22, 11:57 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote: IMHO it is bad practice to store that element in the self, i.e. jQuery, object. ... A simple var should be sufficient. jQuery.fn.myPlugin = function(targetField) { var textfield = jQuery(targetField); .

[jQuery] Re: What am I missing from this plugin?

2007-07-22 Thread Stephan Beal
On Jul 22, 11:57 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote: > IMHO it is bad practice to store that element in the self, i.e. jQuery, > object. ... > A simple var should be sufficient. > > jQuery.fn.myPlugin = function(targetField) { > var textfield = jQuery(targetField); > ... > > }; A

[jQuery] Re: What am I missing from this plugin?

2007-07-22 Thread Klaus Hartl
Stephan Beal wrote: On Jul 22, 2:16 am, barophobia <[EMAIL PROTECTED]> wrote: I think I understand but how do I handle the #passwordField part within the plugin? In your plugin implementation, simply store a reference to the #passwordField passed to your plugin. For example, if you plugin loo

[jQuery] Re: What am I missing from this plugin?

2007-07-22 Thread Stephan Beal
On Jul 22, 2:16 am, barophobia <[EMAIL PROTECTED]> wrote: > I think I understand but how do I handle the #passwordField part > within the plugin? In your plugin implementation, simply store a reference to the #passwordField passed to your plugin. For example, if you plugin looks like this: jQuer

[jQuery] Re: What am I missing from this plugin?

2007-07-21 Thread barophobia
On 7/18/07, Dan G. Switzer, II <[EMAIL PROTECTED]> wrote: > You need to var the generate_to variable in the click handler. Currently > it's a global variable, which makes the second instance overwrite the first > instance. Change: > > generate_to = $(this).attr('for'); > > to: > > var generate_to

[jQuery] Re: What am I missing from this plugin?

2007-07-18 Thread Dan G. Switzer, II
Chris, >I am trying to make a plugin that will be used to generate a password. >After many days of deliberation I decided to call it >generate_password(). Now that I've got the name out of the way I'm >having a bit of trouble getting it to work right. > >You can see the behavior here: > >http://w