ok, i'm not sure if this is the easiest way, however, this is how I
got the form action in the following HTML:

<table width="460" border="0" cellspacing="0" cellpadding="0">
        <tr valign="top">
                <td>
                        <table width="100%" border="0" cellpadding="0" 
cellspacing="0">
                                <tr>
                                        <td valign="top" colspan="2">
                                                <table border="0" 
cellspacing="1" cellpadding="3" width="100%">
                                                        <form Method="Post" 
Action="phoenix.zhtml?c=69181&p=IROL-
irhome&t=SwitchQuote" >
                                                                <tr 
class="modBgQuoteShrtTicker">
                                                                        <td 
colspan="4" nowrap="nowrap">
                                                                                
<span class="modQuoteShrtTicker">
                                                                                
        <Select name="control_Symbol"
ONCHANGE="updateQuote(this);">
                                                                                
                <option value="1" SELECTED="">opt 1</option>
                                                                                
                <option value="2">opt 2</option>
                                                                                
        </Select>
                                                                                
</span>
                                                                        </td>
                                                                </tr>
                                                        </form>

I used:

var formAction = $
(elm).parents('table:first').children("form:first").attr("action");

For some reason, it misses the form object on the way back using
"parents" so i move forward after hitting the FORM's parent to get the
form.  Not sure if this is browser specific, but definitely a
headache. (and the terrible HTML syntax doesn't help either)

Thanks

On May 8, 4:20 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> > I don't know why my reply's aren't showing up, but:
>
> > What if the first parent is not a form (like it could be a
> > label or div)? and also, I would like to avoid using the
> > "name=something" just because the name could change without
> > me knowing it.
>
> Assuming you have a DOM element in 'this', you can get its parent form with:
>
> $(this).parents('form:first')
>
> Since forms can't be nested, you don't actually need the :first part, but
> it's a good habit to get into if you use this technique for other element
> types that can be nested.
>
> BTW, nesting a select element inside a label element only works in some
> browsers (IIRC, it doesn't work in IE). Use the for="id" attribute in your
> label for cross-browser compatibility.
>
> -Mike

Reply via email to