Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

html

php

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

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

var $term = $("textarea#term").val(); 
like image 869
Ahmad Farid Avatar asked Dec 23 '10 12:12

Ahmad Farid


People also ask

What is a multi-line text box?

A multiline text box control is a large text box that can display several lines of text or accept this text from user input. Text boxes are often linked to select value lookups and detailed menus. You can place a multiline text box control within a section control.

Which HTML form input would you use to allow a user to enter multiple lines of text?

The TEXTAREA element creates a multi-line text input control. User agents should use the contents of this element as the initial value of the control and should render this text initially. This example creates a TEXTAREA control that is 20 rows by 80 columns and contains two lines of text initially.

Can an input have multiple types in HTML?

Definition and Usage The multiple attribute is a boolean attribute. When present, it specifies that the user is allowed to enter more than one value in the <input> element. Note: The multiple attribute works with the following input types: email, and file.


1 Answers

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>
like image 163
Nick Craver Avatar answered Sep 28 '22 16:09

Nick Craver