thanks so much karl. that worked first time.
On Oct 8, 8:41 pm, Karl Swedberg <k...@englishrules.com> wrote: > On Oct 8, 2009, at 8:48 AM, webdesignamite wrote: > > > SO, WHAT IM TRYING TO FIGURE OUT IS HOW DO I REFERENCE THE NEXT > > ELEMENT WITH CLASS OF .CLEAR FROM MY PARENT ELEMENT - > > > this gives me the id of the next element with respect to parent (for > > trial and error purposes, ive given all of my .cleared class divs an > > id, ids will be removed) > > > var parentId="dynamic"; > > $("#"+parentId).next().get(0).id > > > so i thought i would need something along the lines of this but it > > doesnt work - > > > var parentId="dynamic"; > > $("#"+parentId).next(".clear").get(0).id > > You're using .next(), but that assumes that the .clear div is the very > next sibling of the parent element. From your description of what > you're doing, though, it isn't clear that .clear is a sibling. If it > is, and if it comes after $("#"+parentId), then you can > use .nextAll('.clear') instead of .next(.'clear') . If it isn't, maybe > you could paste a snippet of your html so that we can see the > relationship between the elements? > > --Karl > > ____________ > Karl Swedbergwww.englishrules.comwww.learningjquery.com