title: jQuery - Compare new value with old value on form submit, across all fields (inputs, selects)?
body: <p>I was reading the <a href="https://stackoverflow.com/questions/1159046/jquery-change-event-on-an-input-element-any-way-to-retain-previous-value">answer to this question</a>, but it solve the problem with just a single field, how would I watch all the fields (input, select, radio, etc...) on a form?</p>
  
  <p>This is what I currently have (I'm using delegate, this form injects to the page dynamically):</p>
  
  <pre><code>$('#preferencesBody').delegate('input[type="radio"], select', 'change', function() {
      var key = $(this).attr('data-key');
      var value = $(this).val();
  
      // How to get the old value, and compare with the current value, if they are different, call saveUserPreferences?
  
      Preferences.saveUserPreferences(key, value);
  });
  </code></pre>
  
  <p>Thanks.</p>