javascript - How to get the number of automatically wrapped lines in textarea in js?
phpcn_u15822017-05-16 13:44:17
0
4
1149
To enter content in a textarea, the default is one line. When too much content is entered, the line will automatically wrap and the height will increase?
This form can also adjust the height, but the scroll bar will flash when the line is changed, and the height will only increase but not decrease, which is the worst writing experience.
1, use shadow
2, use contenteditable attribute
3, if using
This form can also adjust the height, but the scroll bar will flash when the line is changed, and the height will only increase but not decrease, which is the worst writing experience.
Give the textarea an oninput event
Similar to this
http://stackoverflow.com/ques...
The total height of the textarea (use jQ’s element.height(), if it is native js, please check the BIF of the manual) / the row height you defined