I'm using ajaxSubmit plugin to send Ajax forms, but for some reason this plugin doesn't send names/values of input[type=image]
's. So now I'm catching the submit event before ajaxSubmit will handle the form and I need to know if it is possible to find out what button was pressed?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
- how to get selected text from iframe with javascri
This will catch whichever input element initiated the submit:
I found this very useful. It covers the case of clicking, and also submitting with tab index and hitting space or enter. It captures the last input before a submit was made, and that's the button which submitted, so you can have several buttons and check each as a target to perform something unique.
PS: do you have jQuery controling the $ var? Otherwise you have to do this:
if you wan't control on event (form submit)
tell me something if it worked ;)
Following is what I think would be a more comprehensive example of how to accomplish what you asked. You should replace the "#your-form" with your id form and replace "Button One" & "Button Two" with the values on your form buttons.
Hi the answer did not convince me so much here to bring an alternative. What I will do is verify by JS which button was pressed.
Use this page to make the test Test
Saludos