This works for me.
$('textarea').keypress(function(event) {
if (event.keyCode == 13) {
event.preventDefault();
}
});
jsFiddle.
Your second piece looks like it is designed to capture people pasting in multiple lines. In that case, you should bind it to keyup paste.