Set contenteditable=true, to div but do not want to enter to change the line.

brief description: how to press enter without wrapping when div has contenteditable= "true"

Apr.01,2021

overrides the carriage return key (keycode) with an event (blocking default events) to block default line breaks


if (e.charCode === 13) {
  e.preventDefault();
}
Menu