I am trying to reproduce standard instant messenger behavior on TEXT area control: enter works as send button. ctrl+enter as real enter.
$(\"#txtChatMessag
A few potential causes:
Define the function before you reference it.
Make sure you're binding the event in the document.ready event, so that the dom item exists when you reference it.
Change else (e.keyCode == 13) to else if (e.keyCode == 13).
Make sure this is a textarea, not an input[type=text].
Consider using keypress instead of keydown.
Some browsers will send keyCode == 10 instead of keyCode == 13 when using the ctrl modifier key (some browsers will send it even when you aren't using the ctrl modifier key).