Last active
April 26, 2016 21:01
-
-
Save kacpak/69b5f58a316b9d17cbb7e6b3874f2d8b to your computer and use it in GitHub Desktop.
jQuery on value changed
This file contains 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
jQuery.fn.textChange = function(callback) { | |
return this.each(function() { | |
var lastentry = ''; | |
$(this).keyup(function(event) { | |
var value = $(this).val(); | |
if (value != lastentry) { | |
if (typeof callback == 'function') | |
callback.call(this); | |
} | |
lastentry = value; | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment