When a user presses the down arrow key in a textarea, and it's the bottom of the textarea (i.e. the keyup has no effect), I'd like to an event handler to capture this.
$("<textarea />").keyup(function (e) {
switch (e.keyCode) {
case 40: // down
// if last line or alternatively
// if keypress does not change index
// do something.
break;
}
});
Is it possible to achieve this functionality?
As well, I'd be interested in knowing how to capture the opposite - keycode 38 ("up") when at the top of the textarea.
EDIT: Incidentally, I'm using the jQuery FieldSelection plugin, if that's of any assistance.
Thank you for reading; obliged for any input.
Brian