I have a simple form which currently uses jQuery to do some dynamic calculations based on user form input.
Most form fields are disabled and their value is calculated using the values of the non-disabled fields. Part of the calculation involves an AJAX call to save the field value to a database.
I could use the following code:
$('#specific-field').change(function() {
calculateThings();
});
But this would involve repeating for every field whose value can be altered.
I could also do this:
$('form').change(function() {
calculateThings();
});
But then I'd have to save and update every database field every time a change is made, when only one field at a time will potentially contain a different value.
Is there a way to merge the two possibilities, where I can monitor changes at the form level but then detect which specific field within the form was changed?