Skip to content

Instantly share code, notes, and snippets.

@BernardoSilva
Last active December 12, 2015 04:39
Show Gist options
  • Save BernardoSilva/4716266 to your computer and use it in GitHub Desktop.
Save BernardoSilva/4716266 to your computer and use it in GitHub Desktop.
$('.myElements').each(function() {
var elem = $(this);
// Save current value of element
elem.data('oldVal', elem.val());
// Look for changes in the value
elem.bind("propertychange keyup input paste", function(event){
// If value has changed...
if (elem.data('oldVal') != elem.val()) {
// Updated stored value
elem.data('oldVal', elem.val());
// Do action
....
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment