开发者

How to make a textbox of multiple line type in html?

开发者 https://www.devze.com 2023-02-01 03:20 出处:网络
<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 i开发者_
<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 i开发者_如何学运维n the code, like reading its value.

I used to read the input by javascript like that, what should be changed in that as well?

var $term = $("textarea#term").val(); 


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>

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>
0

精彩评论

暂无评论...
验证码 换一张
取 消