showing results for - "prevent default on enter press"
Evann
24 Aug 2017
1/* Jquery method */
2$('#form-input').on('keypress', (e) => { 
3  const keyPressed = e.keyCode || e.which; 
4  if (keyPressed === 13) {
5    e.preventDefault();
6    return false; 
7  }
8  /* or */
9  return keyPressed !== 13;
10});
11
12/* or */
13$('#form-input').on('keypress', (e) => return e.keyCode !== 13);
14
15/* HTML Inline */
16<form ... onkeydown="return event.keyCode !== 13;">
17