How can I get jquery .val() AFTER keypress event?
instead of keypress, use keyup.
Surprised that no one mentioned the js "input" event:
$(someTextInputField).on('input', function() {
alert($(this).val());
});
Recommended.
https://developer.mozilla.org/en-US/docs/Web/Events/input
Change keypress
to keyup
:
$(someTextInputField).on("keyup", function() {
alert($(this).val());
});
keypress
is fired when the key is pressed down, keyup
is fired when the key is released.