> 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