I think you could do something like:
$("div").each(function() {
$(this).css('color', 'red');
});
Basically all this is doing is looping over each DIV on your page and at
each DIV (this) it's changing the color of that div.
Here is another one I did for a recent project - I have a list of
t;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
me and
experimentation to see how it works.
-- Josh
- Original Message -
From: "FrankTudor" <[EMAIL PROTECTED]>
To: "jQuery (English)"
Sent: Thursday, November 29, 2007 11:32 AM
Subject: [jQuery] Re: Explaining this or .this or .this()
Frank
On Nov 29, 12:38
So then it pulls part of a function?
Is 'this' in the example you made pulls $("div") or $("div").each
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 i
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
5 matches
Mail list logo