Created
October 30, 2012 09:53
-
-
Save karlbright/3979341 to your computer and use it in GitHub Desktop.
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
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