Well, it's now tested, and it works!!

I'm very sorry for this probably stupid question, i'm learning
javascript from scratches. Could you explain or point me to the theory
behind this?

thank you so much

alex


On Feb 15, 10:14 pm, "Mike Alsup" <[EMAIL PROTECTED]> wrote:
> Alexandre,
>
> This is untested, but I think it's closer to what you're looking for:
>
> $.fn.myplugin= function(options,callback) {
>     return this.each(function(index) {
>            this.uniq = 'iAmNumber_' + index;
>           options.onIni.apply(this);
>    });
>
> }
>
> On Fri, Feb 15, 2008 at 4:00 PM, Alexandre Plennevaux <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > hey mates,
>
> > I didn't find an answer to my week-old question so i'll rephrase to
> > simplify and focus on just the little bit of knowledge i need from you
> > guys:
>
> > say i want to create a function that performs some jquery methods on an
> > element.
>
> > function doThis(){
> >      $(this).text('i've been changed');
> >      alert("my uniq="+this.uniq);
> > }
>
> > now, inside a plugin, i want to use that function as an option value
>
> > $('div.toBeSelected').myplugin({onIni:doThis});
>
> > here is my pseudo plugin:
>
> > $.fn.myplugin= function(options,callback){
> >     return this.each(function(index){
> >            $this = $(this);
> >            uniq = 'iAmNumber_' + index;
> >           $this.options.onIni();
> >    });
> > }
>
> > So far, the function is called, but the alert returns "my uniq =
> > undefined" and the text() command is not performed.  Why, oh why ?
>
> > --
> > Alexandre Plennevaux
> > LAb[au]
>
> >http://www.lab-au.com

Reply via email to