JQuery event for all clicks Button / Link or DropDown Changes on View

advertisements

I'm working in asp.net mvc3 and have partial views for my tabs and log-in data. In one view (my preview view) I generate some images, and upload them to a cloud and then display them for the user. The user can then select Cancel or Submit.

I'd like to have any button, ActionLink, or dropdown besides Submit do the Cancel function (which involves deleting the images from the cloud, and some other things), but I'm not sure how to get a jQuery event handler for every event besides Submit click. Currently, I have a jQuery "Cancel" function that is bound to a click event on the Cancel button, and now need to expand its usage.

I figured this is self explanatory but if you need to see code, just ask.

All Possible Events: In my partial views, I have these razor html helpers: 2 x @Html.ActionLinks and 1 x @Html.DropDownList

My Cancel and Submit buttons are of this form: <input type="submit" value="Cancel" />

[UPDATE]: I have my click event working now, however I would like to use e.preventDefault(); on my clicks so it doesn't change views before my Cancel/delete finishes, but then how do I synchronously submit an item after my Cancel function finishes? I assume I use a callback, but do I use e.submit() or e.click() or something else? I would like it to work for <a> tags and dropDown changes


How about this?

$("input,a,select").not("input:submit").click(function(e) {
    // do work
});


working example: http://jsfiddle.net/eqwkD/


Update

$("input,a,select").not("#SubmitButton").click(function(e) {
    // do work
});