问题
I want the enter key to save the data to database, but whenever I press it will break and create second line, I just want it stay at one line
<div id="editable" contentEditable="true">Press enter now</div>
回答1:
This is a jquery solution.
$('input').on('keypress', function(e){
if(e.keyCode == 13){
e.preventDefault();
}
});
来源:https://stackoverflow.com/questions/16954446/how-to-disable-the-enter-key-from-going-second-line-when-onpress