JSFiddle - React, Tailwind, and code Playground
by Olga Rosado
HTML
<textarea id="editor" cols="20" rows="10"></textarea>
JavaScript
var lineCount = 0;
$('#editor').keydown(function (e) {
if (e.keyCode == 13) {
lineCount++;
}
if (e.keyCode == 8) {
//needs to remove characters, educt linecount when it gets to first line and reinstate typing
return true;
}
if (lineCount >= 2) {
e.preventDefault();
updatePreviewText();
return false;
}
});