A JavaScript code processes the characters in textarea into each line.
<! Doctype html>
How does JAVA read only the content of the last row of textarea?
If you press enter, you can use split ("\ n") to break down the string and then go to the last element in the array.
If it doesn't, it's hard to get the front-end js to get the length of the string in textarea to get cols rows. Use the string length to mod rows and then subString ??
I have a question: why do I go to the last line?
How to Implement javascript to display only 72 characters in one line, more than 72 characters in addition to one line
Here is 7. Change it to the number you want ~
<Html>
<Head>
<Title> </title>
</Head>
<Body>
<Div id = "hi"> when I go to school late in spring, I don't need to worry about it. When the wind falls into the dark red green leaves, the branches are full. </div>
<Script type = "text/javascript">
Var $ = function (ID) {return document. getElementById (ID );};
Var length = 7;
Var arr = [];
For (var I = 0; I <= $ ("hi"). innerText. length/7; I ++ ){
Arr. push ($ ("hi"). innerText. substring (I * length, (I + 1) * length ));
}
$ ("Hi"). innerHTML = arr. join ("<br/> ")
</Script>
</Body>
</Html>