Yeah plus it was evaluating keyCode == '13' rather than keyCode == 13 (string vs. integer). May or may not matter but I come from a C# background where it would matter a LOT.
Meanwhile, even with the fix it still proves to be broken if you select an avatar. When you finish selecting an avatar (or cancel), you have to click Submit manually or you just get line break in the message textbox.