The full story is I want to disable the submit button on a form's submission to prevent multiple submissions. One of the problems is the form is an ASP.Net MVC Ajax form - <% using (Ajax.BeginForm ... %> - so its javascript onSubmit event is already set and I therefore cannot do this during that event. Unless there's a way to add to the submit event with jQuery? My testing shows that $("#form").submit(...) replaces the submit event and thusly kills MVC's ajaxy stuff.
So what I've done is attached the button-disabling code to the submit button's click event. That works fine ... only it kills the button's submission abilities (nothing happens other than the button gets disabled). I took it a step further and used jQuery to submit the form from the click event. This borks everything, the ajax response comes back as a downloaded file, I assume because MVC's ajax stuff got clobbered again. This is where I'm at:
$("#submitButton").click(function ()
{
var $button = $(this);
$button.parent().submit();
$button.attr("disabled", "disabled");
});
Any one know a work-around?
Turns out it was a bug. See the edited question for the answer.