Reputation: 1291
I have form with multiple submit buttons and on form submission i am checking which button has been clicked via
$('.edit_form').submit(function() {
var btn = event.currentTarget.activeElement
Its not working in Chrome browser. How to resolve this, I don't want to use
$('.btn').live("click",function(){
$('.edit_form').submit();
})
Upvotes: 0
Views: 1894
Reputation: 382092
Only IE sets the event as a global property (well not exactly, see comment). What you need is to use the event passed as first argument to your callback.
Use
$('.edit_form').submit(function(event) { // <== pass the event
var btn = event.currentTarget.activeElement
But binding on the form when you want the button seems strange. You probably shouldn't do that. Consider that the form may receive the submit
event directly, without any button involved.
Upvotes: 1