Skip to content

Instantly share code, notes, and snippets.

@snowbob
Created October 22, 2018 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snowbob/dd2bf278e8788932193fda44c749ebc8 to your computer and use it in GitHub Desktop.
Save snowbob/dd2bf278e8788932193fda44c749ebc8 to your computer and use it in GitHub Desktop.
get previous value
$(document).on('focusin', 'input', function(){
console.log("Saving value " + $(this).val());
$(this).data('val', $(this).val());
}).on('change','input', function(){
var prev = $(this).data('val');
var current = $(this).val();
console.log("Prev value " + prev);
console.log("New value " + current);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment