On my page I use a textarea to input a text and that text is splitted into words and added to a div. At this point there is no problem. The div has a fixed width of 600px and if the text is to long the div starts a new line. Everything pretty normal as far. Now I need to detect, that there was a linebreak, so I can move the text after the linebreak into a new div. Is it somehow possible to detect that linebreak?
I already tried the include() with /n or <br> or <br/>, also the same with matches() and regex expression how many /n are in the text but nothing seems to work. Now the question is: is there even a way to detect that linebreak and if so how would I do that?
Right now I have a javascript function that is called if an input happens in the textarea
<textarea oninput="textfield_handler()" class="form-control" id="tf-input"></textarea>
In the function I check the linebreak with an if-statement
if(lastChild.innerHTML.includes("<br/>"))
{
console.log("LINE BREAK");
}