Created
December 14, 2017 13:01
-
-
Save calvez/49508fcd201fe31c2fa4f8a133d17615 to your computer and use it in GitHub Desktop.
reload if value is changed https://stackoverflow.com/a/2885716
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.valuefield').each(function() { | |
var elem = $(this); | |
// Save current value of element | |
elem.data('oldVal', elem.val()); | |
// Look for changes in the value | |
elem.bind("propertychange change click keyup input paste", function(event){ | |
// If value has changed... | |
console.log('value changed'); | |
needcheck = 1; | |
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