Lets say I have multiple input fields like distance, fuelConsumption, pricePerGallon and I need to calculate total price. But I want to calculate as the user types. So the total price need to be recalculated if any of those inputs changed. To get the single value of the field I use:
$("#form_distance").on('change paste keyup input', function() {
var distance= $(this).val();
});
$("#form_fuelConsumption").on('change paste keyup input', function() {
var fuelConsumption= $(this).val();
});
and so on but how do I check not the single field but multiple fields?
This would be a possible solution:
$("#form_distance, #form_fuelConsumption").on('change paste keyup input', function(){
var distance = $("#form_distance").val();
var fuelConsumption = $("#form_fuelConsumption").val();
...