I'm creating a chat application. If the user hits the "Enter" key while in the message textarea I want to submit the form. However, if the user hits "SHIFT-ENTER" I want it to do a soft return and not submit the form.
I know there is a key capture function I'm just not sure how to do the SHIFT-ENTER part.
Thanks.
On Enter
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Hehehe.... check my code snippet in here for write_r(). Ermm... actually don't that's just how I discovered this 
Here's how to do it:
1. Capture all keypress events
2. Check if keycode == <whatever> the enter keycode is
3. Look if "shiftKey" is set (i.e shift key was held down at the same time)
This info comes out in the window.Event object
Here's how to do it:
1. Capture all keypress events
2. Check if keycode == <whatever> the enter keycode is
3. Look if "shiftKey" is set (i.e shift key was held down at the same time)
This info comes out in the window.Event object