Exactly, it was my intention to make a pointer to the element only :o)

If I trace both elements in firebug, it highlights same element.
That's what confused/tricked me.

Anyway I read into it, and apparently $(this) and this is two
different instances of the same element.
$(this) pointing to the element object and this pointing to the DOM
element if I'm correct.

Solution:

var foo = false;

$('div span').each(function() {

foo = this;

// debugging in firebug
console.log(this, foo);
console.log(this == foo);

});

Thanks for your help :o)

On 8 Maj, 23:36, mrpollo <[EMAIL PROTECTED]> wrote:
> actually you are not cloning your element, you are just making a
> pointer of the element in this line
>
> foo = $(this);
>
> so its not the same element, its just a pointer comparing with an
> actual element DOM object
>
> you can see it live in action in this site if you have firebug
>
> http://x1fm.com/music/blog
> run your code
>
> var foo = false;
>
> jQuery('div div div div div div div div div').each(function() {
>
> foo = jQuery(this);
>
> // debugging in firebug
> console.log(jQuery(this), foo);
> console.log(jQuery(this) == foo);
>
> });
>
> if you get div's out of the initial selector you are going to get more
> results but i think with those its just fine for now
> in the firebug console check the results and get your mouse over the
> elements that the trace did, you are going to see that one of them
> actually gets highlighted in the rendered web page and the other
> doesn't, but if you do click on them you are getting for sure the same
> result, so you may want to look to another way around the problem you
> were trying to solve with your solution
> unless im really wrong, and if i am please guys correct my path
>
> On May 8, 12:58 pm, Jong <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm pretty new to jQuery, and I have stumbled across a weird problem.
> > It may just be me fooling around, anyway here goes...
>
> > var foo = false;
>
> > $('div span').each(function() {
>
> > foo = $(this);
>
> > // debugging in firebug
> > console.log($(this), foo);
> > console.log($(this) == foo);
>
> > });
>
> > You should, at least I am, think it's the same element, although it
> > returns false! I cannot figure out why.

Reply via email to