I want to press arrow down key automatically when user presses enter on my contenteditable div and here is my code i have tried
$('body').on('keypress', '.chat_txt', function(e) {
if (e.keyCode === 13) {
e.preventDefault();
e.stopPropagation();
$(this).append('\n');
$(this).trigger({ type: 'keypress', which: 40});
}
});
But unfortunately this code is fruitless.
JsFiddle
https://jsfiddle.net/2q9x4xzm/