Last active
August 29, 2015 13:56
-
-
Save ducdhm/9244391 to your computer and use it in GitHub Desktop.
Get value when press key down with keydown2
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
$('#query').keydown2(function () { | |
console.log($(this).val()); | |
}); |
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
(function($) { | |
$.fn.keydown2 = function(callback) { | |
return $(this).each(function() { | |
var control = $(this); | |
control.keydown(function() { | |
setTimeout(function() { | |
callback.call(control, callback); | |
}, 0); | |
}); | |
}); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment