'Textarea doesn't break line on 'enter' press

I have a project with a lot of libraries, like jQuery, Kendo and AngularJS. After an update with many commits textarea stopped breaking to a new line by [Enter] press. Maybe, somewhere the event has been unbound or a library interrupts. I tried to get listeners for the object by JQuery.data(element), but it got undefined. How can I debug it?



Solution 1:[1]

Found a problem. Somewhere in the code:

$(document).keypress(function (e) {
    if (e.which == 13) {
        e.preventDefault();
    }
});

It was used to catch 'Enter' press, that led to another page, because menu element was focused on start.

Solution 2:[2]

Try this:

$('textbox').keypress(function(e){
  e.stopPropagation();
});

This will prevent any other binded event to be fired when user writes inside the textbox.

Solution 3:[3]

In my case Enter and arrow keys were not working, key-press wasn't detecting the events, changed to key-down, it worked

$(document).ready(function () {
    $('input, textarea').keydown(function (e) {
        e.stopPropagation();
    });
});

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 linktoahref
Solution 2 pablito.aven
Solution 3 linktoahref