37
rated 0 times
[
43]
[
6]
/ answers: 1 / hits: 31771
/ 15 Years ago, thu, november 19, 2009, 12:00:00
I have a form in HTML with multiple inputs of type submit:
<form id = myForm1 action=doSomethingImportant/10 class=postLink method=post>
<input type=hidden id=antiCSRF name=antiCSRF value=12345></input>
<input type=submit value=clickThisLink></input>
<input type=submit value=Don'tclickThisLink></input>
</form>
What I want to do is select only the first input with type submit while ignoring the others, the snippet of code I currently have is as follows, note it is within a for-each loop that goes through all forms on my page, hence (this) to avoid confusion:
var name = $(this).find(input[type='submit']).val();
I'm thinking this already grabs the first input of type submit by default, I'm not sure if that assumption is correct or if there's a more formal way of going about it, thanks.
More From » jquery