Re: [jQuery] Reference to the last DIV in a group?
A completely different option is to write your code in reverse: $('Hello') .appendTo("#todoList") .slideDown("slow"); In this case, the slideDown will effect the last element in the todoList (the one you just added). Just something to consider :-) --John On 2/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > > I have a main div, with id= "todoList", and within it, a number of DIVs, all > with classes "sidebarToDo". Let's say I have just added a DIV to the DOM ... > > $('#todoList').append('Hello'); > > How do I now get a reference to this last DIV with class "sidebarToDo"? > Notice it doesn't have an ID, but it is the last one in the master todoList > DIV. > > Thanks so much. This discussion group is excellent. - Dave > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Reference to the last DIV in a group?
Also try this, it will just take the last div.sidebarToDo _inside_ #todoList. $('#todoList > div.sidebarToDo:last'); On 2/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hello, I have a main div, with id= "todoList", and within it, a number of DIVs, all with classes "sidebarToDo". Let's say I have just added a DIV to the DOM ... $('#todoList').append('Hello'); How do I now get a reference to this last DIV with class "sidebarToDo"? Notice it doesn't have an ID, but it is the last one in the master todoList DIV. Thanks so much. This discussion group is excellent. - Dave ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Joan Piedra || Frontend webdeveloper http://joanpiedra.com/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Reference to the last DIV in a group?
Indeed...efficiency is ranked near the tippy-top in my book. _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Domigan Sent: Thursday, February 22, 2007 1:27 PM To: jQuery Discussion. Subject: Re: [jQuery] Reference to the last DIV in a group? The beautiful terseness makes me cry. Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Reference to the last DIV in a group?
The beautiful terseness makes me cry. Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Reference to the last DIV in a group?
Try this: $('div.sidebarToDo:last') --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 22, 2007, at 12:07 PM, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: Hello, I have a main div, with id= "todoList", and within it, a number of DIVs, all with classes "sidebarToDo". Let's say I have just added a DIV to the DOM ... $('#todoList').append('Hellodiv>'); How do I now get a reference to this last DIV with class "sidebarToDo"? Notice it doesn't have an ID, but it is the last one in the master todoList DIV. Thanks so much. This discussion group is excellent. - Dave ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Reference to the last DIV in a group?
Hello, I have a main div, with id= "todoList", and within it, a number of DIVs, all with classes "sidebarToDo". Let's say I have just added a DIV to the DOM ... $('#todoList').append('Hello'); How do I now get a reference to this last DIV with class "sidebarToDo"? Notice it doesn't have an ID, but it is the last one in the master todoList DIV. Thanks so much. This discussion group is excellent. - Dave ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/