I am making a WYSIWYG editor, what I want to do is preventDefault
on the enter key, and instead, when enter is pressed, it creates a new line, with tags <div></div>
. So essentially each <div>
is one line. I don't know how to create the <div>
and have the pointer start between each <div>
like this:
<div>Line one here</div> // Press enter
<div>Start typing next line here</div> // When you press Enter, it creates a div and automatically when you start typing its in between the tags.
Then after you press a new line again, it just creates another <div>
for the next line... Can anyone help? I don't need help with the preventDefault
, just the new action to be taken if Enter is pressed.