Would the blur
event not give you the behavior you want?
Also, have you looked at a delegated event? With a delegated approach you use a single event handler to deal with events raised by multiple elements. So if you had a table with 10,000 cells, and you wanted to perform some action on click, instead of attaching an event handler to every one - which would be costly for performance - we attach one event handler to the table which is delegated to handle all events.
So following this paradigm, you could always have a single event handler for a form which handles every input in that form.
$("form").on("blur", ":input", function(e) {
// this refers to whichever form element triggered the event
var $this;
$.ajax({
type: "POST",
url: "Form.aspx/Save",
data: "{'id': '" + $this.attr("id") + "','value': '" + $this.val() + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
if (msg.d == 'success') {
}
}
});
e.preventDefault();
});