This will break when you have a textarea.

Instead of watching click on the button and keypress, you should watch click on the button and submit IMO.