On 11/08/06, Larry Garfield <[EMAIL PROTECTED]> wrote: > Another question that I've not found a solution to in the Docs yet. The > jQuery object, in combination with .find(), offers a zillion ways to seek > to a given element or elements and then traverse the tree down from there. > What about going up? Say I want to attach an event handler to an > element, then in the event handler I want to seek *up* the DOM to the > next, say, tr tag and then from there scan back down to elements with > certain classes? (Actual example I had to do recently in a straight-JS > project.) How would I do that with jQuery? Or would we need to add a > .climb() plugin? > > On a related note, is there a way to extract the actual DOM nodes from a > jQuery object to do basic JS manipulation on them? > > -- > Larry Garfield
If you want to return to where you came from use end(): $("p").find("a").click(clickFunction).end().css("border", "1px solid #000"); Which will find all 'p' elements, assign a click function to the anchors and then return and apply a border to the 'p'. You can use parents(), which is useful if you don't want to go to where you were before the find(). $("p").find("a").click(clickFunction).parents("span").css("color", "#f00"); _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/