Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats the difference between textarea and input type text in angularjs

Just not sure what the difference is. Trying to figure out what's best for my use case.

like image 565
aintnorest Avatar asked Feb 11 '14 09:02

aintnorest


People also ask

What is the difference of input type text and textarea?

The difference between these both HTML field types is, that the input creates a smaller single line input box, while the textarea creates a bigger box meant for longer texts, like messages.

What is the benefit of a textarea over input type text?

<textarea>: The Textarea element. The <textarea> HTML element represents a multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text, for example a comment on a review or feedback form.

Why is textarea not an input type?

A textarea can contain multiple lines of text, so one wouldn't be able to pre-populate it using a value attribute. Similarly, the select element needs to be its own element to accommodate option sub-elements.

Can we use textarea in input type?

To add a multi-line text input, use the HTML <textarea> tag. You can set the size of a text area using the cols and rows attributes. It is used within a form, to allow users to input text over multiple rows. Specifies that on page load the text area should automatically get focus.


2 Answers

The difference regards HTML and is not related to AngularJS. Anyway some definitions from the W3Schools site:

input type text:

The <input> tag specifies an input field where the user can enter data.

<input> elements are used within a <form> element to declare input controls that allow users to input data.

An input field can vary in many ways, depending on the type attribute.

Textarea:

The <textarea> tag defines a multi-line text input control.

A text area can hold an unlimited number of characters, and the text renders in a fixed-width font (usually Courier).

The size of a text area can be specified by the cols and rows attributes, or even better; through CSS' height and width properties.

You can find definitions and examples here: input and text area

like image 161
Atropo Avatar answered Sep 18 '22 15:09

Atropo


Generally speaking an input field is a one-line field (probably to carry something like first name or last name, a phone number, an email). A textarea is a multi-line field that allows you to press ENTER! They are used for addresses or others long and complex type of data (also notes, for instance).

like image 33
matteopuc Avatar answered Sep 19 '22 15:09

matteopuc