I think this will do it for you, although haven't tested:
  $(#myInput).parentNode;

On 3/23/07, Dan Eastwell <[EMAIL PROTECTED]> wrote:

I know I can use parents to get the ancestors of my input, but this
will get all forms on the page

$(#myInput).parents("form");

How do I find the one the form is in?

var formItsIn = checkAncestors(theSearchBox, "form");

function checkAncestors(theItem, requiredAncestor){
        var theparent = theItem.parentNode.nodeName.toLower();
        if(theparent == requiredAncestor){
                return theparent;
        }else{
                checkAncestors(theparent, requiredAncestor);
        }
}


my code above seems a bit much to me, and it's not jquery!

Cheers,

Dan.


--
Daniel Eastwell

Portfolio and articles:
http://www.thoughtballoon.co.uk

Blog:
http://www.thoughtballoon.co.uk/blog

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/




--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
"There's a whale there's a whale there's a whale fish" he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to