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