I'm using the following code JSFiddle:
$("form").submit(function() {
$(':submit', this).attr('disabled', true);
$(this).append($('<input/>').attr({
type: 'hidden',
name: $(':submit', this).attr('type'),
value: $(':submit', this).attr('value')
}));
});
<input type="submit" value="Approve" /> <input type="submit" value="Update" />
This successfully disables the buttons on submit, but I'm trying to send the appropriate value. It doesn't matter which button is clicked, it always returns the value of the first button. How can I resolve this?
What I want to happen is when you click "Approve" it sends "Approve", and when you click "Update" it sends "Update".