47

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

Arslan Ali
  • 17,418
  • 8
  • 58
  • 76
aintnorest
  • 1,326
  • 2
  • 13
  • 20
  • 1
    Well, so what's your case and what you don't understand about them? Please be **much more** specific describing your problem. – Adriano Repetti Feb 11 '14 at 09:40
  • Just see [this one](http://stackoverflow.com/questions/5637326/why-isnt-textarea-an-inputtype-textarea) for reference. – xji Jan 07 '15 at 03:50

7 Answers7

45

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

rath
  • 3,655
  • 1
  • 40
  • 53
Atropo
  • 12,231
  • 6
  • 49
  • 62
  • 1
    Doesn't Angularjs also have several properties associated with each. For instance text area doesn't have Trim. Either way answer was useful enough. Thanks. – aintnorest Feb 11 '14 at 10:08
17

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

superpuccio
  • 11,674
  • 8
  • 65
  • 93
  • I think this answer shows a remarkable difference between input and textarea. "Pressing Enter". Thanks for pointing out! – benni Apr 04 '23 at 21:51
6

Maybe this is to obvious, but just thought to mention:

  • Textarea value - The value of the textarea object is the html inside of the start and end tags of it.

  • Input value - The input object value of the input is found inside the attribute value.

user2100789
  • 61
  • 1
  • 3
  • 1
    If the value is sent to the server-side, both values will be considered as a string? In other words, if Textarea's value is the same as Inputs', server-side will consider them as the same? – shintaroid Jan 31 '18 at 09:22
5

TextArea holds multiple lines, input text is only for one line the difference in declaration is as follows

<input name="txtDescEd" type="text"  />
<textarea name="txtDescEd" cols="60" rows="10"></textarea>
killerbarney
  • 947
  • 10
  • 24
Daniel
  • 605
  • 1
  • 8
  • 19
1

The major difference between a textarea and a text field ( ), is that a text field only has one line, whereas a textarea usually has multiple lines.

Avinash Garg
  • 1,374
  • 14
  • 18
0

TextBox: the input element defines an input field. A TextBox is created by specifying the type attribute to "text". TextArea:the TextArea element defines a multi-line text area.

-4

INPUT tag always start write from the middle of block of inputfield. Where as TextArea always start from top of the box of input field whatever their height and width is.