How to find the submit button in a specific form in jQuery

Posted by leifg on Stack Overflow See other posts from Stack Overflow or by leifg
Published on 2010-05-23T17:20:57Z Indexed on 2010/05/23 17:30 UTC
Read the original article Hit count: 130

Filed under:
|

I try to get jQuery object of a submit button in a specific form (there are several forms on the same page).

I managed to get the form element itself. It looks something like this:

var curForm = curElement.parents("form");

The current Element has the context HTMLInputElement. The several techniques I tried to get the according submit element of the form:

var curSubmit = curForm.find("input[type='submit']");
var curSubmit = $(curForm).find("input[type='submit']");    
var curSubmit = curForm.find(":submit");
var curSubmit = $(curForm).find(":submit");    
var curSubmit = $(curSubmit, "input[type='submit']");

the result is always the same (and very strange). The result that I get is the same element as "curElement".

So how can I get the right submit button?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery