[jQuery] Re: Can you help me understand .end() ?

2009-04-23 Thread JKippes
Thanks so much Ricardo and MorningZ ! I think I have a good understanding now. On Apr 22, 7:11 pm, MorningZ morni...@gmail.com wrote: In the example provided on the page I was viewing,     $(a).filter(.clickme).click(function(){ alert(You are now leaving the site.); }).end() can you

[jQuery] Re: Can you help me understand .end() ?

2009-04-22 Thread MorningZ
Say you have the html of div spanOne/span spanTwo/span spanThree/span /div and say: var $obj = $(div); your jQuery object, $obj, will be just the div tag Now if you say var $obj = $(div).find(span); that would first be an object representing the div and the .find() makes it be

[jQuery] Re: Can you help me understand .end() ?

2009-04-22 Thread Andy Matthews
you help me understand .end() ? Say you have the html of div spanOne/span spanTwo/span spanThree/span /div and say: var $obj = $(div); your jQuery object, $obj, will be just the div tag Now if you say var $obj = $(div).find(span); that would first be an object representing the div

[jQuery] Re: Can you help me understand .end() ?

2009-04-22 Thread MorningZ
-Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: Wednesday, April 22, 2009 1:06 PM To: jQuery (English) Subject: [jQuery] Re: Can you help me understand .end() ? Say you have the html of div     spanOne/span

[jQuery] Re: Can you help me understand .end() ?

2009-04-22 Thread Ignacio Cortorreal
if you do something like: $(div).find(span).css('background':'red').end().css('background':'green'); spans will be red, and the divs will be green. .end() reset the chain to the first selector On Wed, Apr 22, 2009 at 2:05 PM, MorningZ morni...@gmail.com wrote: Say you have the html of

[jQuery] Re: Can you help me understand .end() ?

2009-04-22 Thread JKippes
MorningZ and Ignacio, Thanks so much for the examples. Both helped me understand .end() better. I have a couple additional questions to solidfy my understanding. Is this example, $(div).find(span).css('background':'red').end().css ('background':'green­'); mainly where you see .end() being

[jQuery] Re: Can you help me understand .end() ?

2009-04-22 Thread Ricardo
In the docs example end() is not doing anything useful, it's just showing where end() fits. I use it to avoid repeating selectors: $('#myform') .find('input') .click(fn..).end() .find('textarea') .mouseover(fn...).end() .find('label') .css('color', 'red'); Limiting

[jQuery] Re: Can you help me understand .end() ?

2009-04-22 Thread MorningZ
In the example provided on the page I was viewing, $(a).filter(.clickme).click(function(){ alert(You are now leaving the site.); }).end() can you describe what .end() is doing? .end() is doing absolutely nothing but at that point you are back to the collection of a's in the chain and