可能是重复的问题:
如何获取<textarea>中的行数?
我有一个textarea
,我在里面写了7行
文字,只使用了2个换行符
,就像下面这样,想象一下以下代码框是一个textarea
,只按了两次回车键。
A text box, text field or text entry box is a kind of widget used when building
a graphical user interface (GUI). A text box purpose is to allow the user to
input text information to be used by the program.
User-interface guidelines recommend a single-line text box when only one line of
input is required, and a multi-line text box only if more than one line of input
may be required.
Non-editable text boxes can serve the purpose of simply displaying text.
如果在写了一些行之后,现在的
文本区域行数
为n
。我该如何计算n
的值?在回答问题之前,请明确表达。我不想像这个链接中那样计算我的文本中有多少
换行符
。如何获取文本区域中的行数?
我想要像Microsoft Word一样计算一段文字的行数。请不要使用jQuery...