Michel, thanks for your response. So, do I need to get the parent of my country element (which would be the div ) & get all it's siblings and then look for elements with class 'state' or is there a simpler way?
On Dec 4, 12:47 am, Michel Belleville <michel.bellevi...@gmail.com> wrote: > That's easy, .next() finds the nearer next *sibling* of current element > matching the selector. In your case, your element is not current element's > sibling, it's under another node altogether. > > <div> > <span class="me">hey, it's me !!</span> > <span>and I'm his sibling</span> > <a>and I am too</a> > <p> > <span>though I am not because I'm not the direct child of the same direct > parent</span> > </p> > </div> > <div> > <a>neither am I, I'm also in another parent, the fact that I'm on the same > indentation level is not enough to make me directly related to this "span.me" > guy</a> > </div> > > Hope it helps. > > Michel Belleville > > 2009/12/4 TMNT <tmand...@gmail.com> > > > Thank you jpcozart. here's part of my html: > > > <div class="form-item" id="edit-question-900-wrapper"> > > <label for="edit-question-900">Country of ED Submitter <span > > class="form-required" title="This field is required.">*</span>: </ > > label> > > <select name="question_900" class="form-select country" > > disabled="disabled" id="edit-question-900" ><option value="">-- Select > > country --</option><option value="1039" selected="selected">Canada</ > > option><option value="1111">Kazakhstan</option><option > > value="1177">Russian Federation</option><option > > value="1191">Singapore</option><option value="1193">Slovenia</ > > option><option value="1196">South Africa</option><option > > value="1228">United States</option></select> > > </div> > > <div class="form-item" id="edit-question-898-wrapper"> > > <label for="edit-question-898">State or Region of ED Submitter <span > > class="form-required" title="This field is required.">*</span>: </ > > label> > > <select name="question_898" class="form-select state" > > disabled="disabled" id="edit-question-898" ><option value="">-- Select > > one --</option><option value="1100" selected="selected">Alberta</ > > option><option value="1101">British Columbia</option><option > > value="1102">Manitoba</option><option value="1103">New Brunswick</ > > option><option value="1104">Newfoundland and Labrador</option><option > > value="1105">Northwest Territories</option><option value="1106">Nova > > Scotia</option><option value="1107">Nunavut</option><option > > value="1108">Ontario</option><option value="1109">Prince Edward > > Island</option><option value="1110">Quebec</option><option > > value="1111">Saskatchewan</option><option value="1112">Yukon > > Territory</option></select> > > </div> > > > On Dec 3, 2:24 pm, jpcozart <jeremy.coz...@gmail.com> wrote: > > > I would have to see the structure of the document to know where the > > > problem lies. It seems as though > > > > country.next("select.state"); > > > > is not returning the node you are looking for. > > > > On Dec 3, 1:07 pm, TMNT <tmand...@gmail.com> wrote: > > > > > Matt, thanks for your response. > > > > > I had originally posted this on jquery-dev group but was referred to > > > > this group. > > > > How do I access the id of the jquery object returned from the next() > > > > function? > > > > I tried Matt's suggestion below but I get an 'undefined' when I alert > > > > state.attr('id'). > > > > thank you. > > > > > From: Matt Maxwell <leftwithoutli...@gmail.com> > > > > Date: Thu, 3 Dec 2009 05:28:48 -0600 > > > > Local: Thurs, Dec 3 2009 3:28 am > > > > Subject: Re: [jquery-dev] Re: next() > > > > Reply | Reply to author | Forward | Print | Individual message | Show > > > > original | Report this message | Find messages by this author > > > > > I would do something like > > > > > $("select.country").change(function () { > > > > var country = $(this), > > > > country_id = country.attr("id"), > > > > state = country.next("select.state"); > > > > > }); > > > > > state isn't the DOM element, it's the jQuery object, so you'd have to > > > > go > > > > alert(state.attr("id")); > > > > > Hope this helps. > > > > > Also, I agree with Dave, this isn't the place for this kind of > > > > question. > > > > > - Hide quoted text - > > > > - Show quoted text - > > > > On Wed, Dec 2, 2009 at 6:20 PM, Dave Methvin <dave.meth...@gmail.com> > > > > wrote: > > > > > > The jQuery-en group is a better fit for this question. This group is > > > > > for the discussion of the development of jQuery itself. > > > > > --