[jQuery] jQuery Plugin question

2006-10-04 Thread Yehuda Katz
Is there a way to set a variable in an each that will be stored separately for each instance of the plugin (for example, if I am performing an action on all s, is there a way to store the input type and reuse it later?). Maybe I'm not being clear, so here's the example:                 $(".slider"

Re: [jQuery] jQuery Plugin question

2006-10-04 Thread Brandon Aaron
Also most JavaScript compressors depend on the var being their or you could get undesired results. -- Brandon Aaron On 10/4/06, Jörn Zaefferer <[EMAIL PROTECTED]> wrote: > Ⓙⓐⓚⓔ schrieb: > > Javascript doesn't have block scoping, providing only global and > > function scopes! > > > That may be rig

Re: [jQuery] jQuery Plugin question

2006-10-04 Thread Jörn Zaefferer
Ⓙⓐⓚⓔ schrieb: > Javascript doesn't have block scoping, providing only global and > function scopes! > That may be right, but in most cases it is enough to keep your code clean to prevent problems resulting from the non-existant block scope. On the other hand, creating global variables causes q

Re: [jQuery] jQuery Plugin question

2006-10-04 Thread Ⓙⓐⓚⓔ
While I agree that var is often missing and global vars are often not a good idea... In JS vars are not scoped in a for or if so var inside the for (or if) does little more than a var before it. This is the reason that we have to resort to the confusing looking function(){var x = 1...}(); wh

Re: [jQuery] jQuery Plugin question

2006-10-04 Thread Dave Methvin
> Is there a way to set a variable in an each that will be stored > separately for each instance of the plugin (for example, if I am > performing an action on all s, is there a way to store the > input type and reuse it later?). Maybe I'm not being clear, so > here's the example: > >

Re: [jQuery] jQuery Plugin question

2006-10-04 Thread Brian Miller
Create an empty object, pass it to the .each() block, and add each id as a property of it as you go. My first crack (which is probably hopelessly b0rked, but may get the point across...): var myInputs = {}; function sliderCallback { myInputs[this.id].rangeEl = $(this).siblings().filter("input.ran