Html angularjs中的textarea和input类型文本有什么区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21698065/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 00:53:34  来源:igfitidea点击:

Whats the difference between textarea and input type text in angularjs

htmlinputtextarea

提问by aintnorest

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

只是不确定有什么区别。试图找出最适合我的用例的方法。

回答by Atropo

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

差异HTML与 无关AngularJS。无论如何,W3Schools 网站上的一些定义:

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.

<input>标签指定用户可以输入数据的输入字段。

<input>元素在元素中用于<form>声明允许用户输入数据的输入控件。

输入字段可以以多种方式变化,具体取决于类型属性。

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 colsand rowsattributes, or even better; through CSS' heightand widthproperties.

<textarea>标签定义了一个多行文本输入控件。

一个文本区域可以容纳无限数量的字符,并且文本以固定宽度的字体(通常是 Courier)呈现。

文本区域的大小可以由colsrows属性指定,甚至更好;通过 CSS'heightwidth属性。

You can find definitions and examples here: inputand text area

您可以在此处找到定义和示例:输入文本区域

回答by superpuccio

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

一般来说,输入字段是一个单行字段(可能带有诸如名字或姓氏、电话号码、电子邮件之类的内容)。textarea 是一个多行字段,允许您按 ENTER!它们用于地址或其他长而复杂的数据类型(例如,还有注释)。

回答by Nate

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

TextArea 保存多行,输入的文本只有一行,声明的区别如下

<input name="txtDescEd" type="text"  />
<textarea name="txtDescEd" cols="60" rows="10"></textarea>

回答by user2100789

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.

  • Textarea 值 - textarea 对象的值是它的开始和结束标签内的 html。

  • 输入值 - 在属性值中找到输入的输入对象值。

回答by Avinash Garg

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.

textarea 和 text field ( ) 之间的主要区别在于文本字段只有一行,而 textarea 通常有多行。

回答by Nikita takate

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.

TextBox:输入元素定义了一个输入字段。通过将 type 属性指定为“text”来创建 TextBox。TextArea:TextArea 元素定义了一个多行文本区域。

回答by user12093882

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.

INPUT 标签总是从输入字段块的中间开始写入。因为 TextArea 总是从输入字段框的顶部开始,无论它们的高度和宽度是多少。