如何在html中创建多行类型的文本框? [英] How to make a textbox of multiple line type in html?
本文介绍了如何在html中创建多行类型的文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<input class="FormElement" name="term" id="term" type="text">
我应该对这个文本框做些什么修改以使其成为多行,而不需要修改其他任何内容在代码中,就像读取它的值一样。
What modifications should I do to this textbox to make it multiple line, without the need to modify anything else in the code, like reading its value.
我用JavaScript读取输入内容,还应该改变什么?
I used to read the input by javascript like that, what should be changed in that as well?
var $term = $("textarea#term").val();
推荐答案
您需要一个 < textarea>
与名称相同,所以替换为:
You need a <textarea>
with the same name
, so replace this:
<input class="FormElement" name="term" id="term" type="text">
有了这个:
With this:
<textarea class="FormElement" name="term" id="term" cols="40" rows="4"></textarea>
cols
参数分别是宽度/高度...或使用CSS样式指定大小,如下所示:
The rows
and cols
arguments are the width/height respectively...or use CSS styling to specify the size, like this:
<textarea class="FormElement" name="term" id="term" style="width: 200px; height: 40px;"></textarea>
这篇关于如何在html中创建多行类型的文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文