Skip to content

Instantly share code, notes, and snippets.

@karlbright
Created October 30, 2012 09:53
Show Gist options
  • Save karlbright/3979341 to your computer and use it in GitHub Desktop.
Save karlbright/3979341 to your computer and use it in GitHub Desktop.
Agworld.bindInputUpdateToElement = function (input, element) {
input = $(input);
element = $(element);
if (input.length > 0 && element.length > 0) {
input.keypress(function () {
var data = input.data();
if (data.timer !== undefined) {
clearTimeout(data.timer);
}
data.timer = setTimeout(function () {
element.text(input.val());
}, 400);
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment