I fell like I could get this concept.  I'm close.  I think I need to
create something, but i don't no 'this' so I don't know how to use it.

Does that example work that you posted...where does it log?  to the
current directory?

I can't 'write' or 'create' in the environment i working.  Could you
maybe work the example so that it outputs to the screen.  I can make a
sample file with 'div' tags point to my jquery.js file.  I have done
jquery scripts without the 'this' part and I would attempt to change
it but 'this' is a stumper for me.

Frank

On Nov 29, 1:42 pm, "Josh Nathanson" <[EMAIL PROTECTED]> wrote:
> > So then it pulls part of a function?
>
> > Is 'this' in the example you made pulls $("div") or $("div").each
>
> It doesn't pull part of a function...it pulls the object within which the
> function is executing.
>
> In my example, the function is "each", and the object within which it is
> executing is the jQuery object (which is an array of div elements) returned
> by $("div").  So, "this" would refer to the current div element which is
> being iterated.
>
> It's not easy to wrap your mind around it, it definitely takes some time and
> experimentation to see how it works.
>
> -- Josh
>
> ----- Original Message -----
> From: "FrankTudor" <[EMAIL PROTECTED]>
> To: "jQuery (English)" <jquery-en@googlegroups.com>
> Sent: Thursday, November 29, 2007 11:32 AM
> Subject: [jQuery] Re: Explaining this or .this or .this()
>
> > Frank
>
> > On Nov 29, 12:38 pm, "Josh Nathanson" <[EMAIL PROTECTED]> wrote:
> >> I'll give it a shot...and please gurus correct any mistakes here..."this"
> >> refers to the object context within which it is referenced at runtime.
>
> >> So, if you have a bunch of divs:
>
> >> $("div").each(function() {
> >>     console.log(this);
>
> >> });
>
> >> You will see in the console each of the divs as it loops over them.
>
> >> Every javascript function runs within the context of some object -- at
> >> the
> >> highest level this is the window (global) object.
>
> >> To understand context and scoping better, I highly recommend checking out
> >> John Resig's book "Advanced JavaScript Techniques," it cleared up a lot
> >> of
> >> confusion for me.
>
> >> -- Josh
>
> >> ----- Original Message -----
> >> From: "FrankTudor" <[EMAIL PROTECTED]>
> >> To: "jQuery (English)" <jquery-en@googlegroups.com>
> >> Sent: Thursday, November 29, 2007 8:14 AM
> >> Subject: [jQuery] Explaining this or .this or .this()
>
> >> > There is a concept I am struggling with and I am not sure how to
> >> > approach it.  I am trying to understand:
>
> >> > .this
>
> >> > I don't know if an explanation or an example would be best. But I want
> >> > to understand it.
>
> >> > I have tried to read an explanation and it doesn't make sense.
>
> >> > Can someone help me?
>
> >> > Frank

Reply via email to