Skip to content

Instantly share code, notes, and snippets.

@samuelcar
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save samuelcar/a433d45dae3d494b01d9 to your computer and use it in GitHub Desktop.

Select an option

Save samuelcar/a433d45dae3d494b01d9 to your computer and use it in GitHub Desktop.
detects when the user inputs over a forms field
var propertyChangeUnbound = false;
$("#testbox").on("propertychange", function(e) {
if (e.originalEvent.propertyName == "value") {
alert("Value changed!");
}
});
$("#testbox").on("input", function() {
if (!propertyChangeUnbound) {
$("#testbox").unbind("propertychange");
propertyChangeUnbound = true;
}
alert("Value changed!");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment