How to keep track of changing value at least one input in jQuery?

Please help.
Source: have a form with 8 fields input type="text".
Goal: changing at least one of them to show the "Save" button conversely, if no changes, the button disappears.

Wrote the code:
$('#contactMe input').each(function(){
 var hotelInfo = $(this).val();

$(this).change(function(){
 var hotelInfoR = $(this).val();
 if ( hotelInfoR != hotelInfo ) {
alert('changed');
 } else {
 alert('not changed');
}
});

 });

It works, but only for each input's and separately. That is, if the change in two - everything is OK, shows the button. But if return the old value in one of two izmenennykh = button is hidden, even though not intended by design.
https://jsfiddle.net/dtwvhpt6/

That you need to add code for this? Plugins are not welcome :)
August 19th 19 at 23:02
0 answer

Find more questions by tags HTML