How to disconnect the enter key from the second line when pressed?

I want the enter key to save the data in the database, but whenever I press it, it breaks and creates a second line, I just want it to stay on the same line

<div id="editable" contentEditable="true">Press enter now</div> 
0
source share
1 answer

This is a jQuery solution.

 $('input').on('keypress', function(e){ if(e.keyCode == 13){ e.preventDefault(); } 

});

+1
source

Source: https://habr.com/ru/post/1497586/


All Articles