Questions tagged [textarea]

A textarea is an HTML element (tag) used to create a multi-line plain-text editing field.

This tag should be used for questions related to the usage of the HTML <textarea> element.

A <textarea> is an HTML element (tag) used to create a multi-line plain-text editing field.

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.

In HTML 5, the maxlength attribute enables you to specify a maximum length for your <textarea> element. This attribute was not supported in previous versions of HTML.

Resources

6376 questions
3234
votes
22 answers

How do I disable the resizable property of a textarea?

I want to disable the resizable property of a textarea. Currently, I can resize a textarea by clicking on the bottom right corner of the textarea and dragging the mouse. How can I disable this?
user549757
  • 32,962
  • 4
  • 19
  • 20
588
votes
28 answers

Set value of textarea in jQuery

I am attempting to set a value in a textarea field using jquery with the following code: $("textarea#ExampleMessage").attr("value", result.exampleMessage); The issue is, once this code executes, it is not altering the text in the textarea? However…
GONeale
  • 26,302
  • 21
  • 106
  • 149
514
votes
47 answers

Creating a textarea with auto-resize

There was another thread about this, which I've tried. But there is one problem: the textarea doesn't shrink if you delete the content. I can't find any way to shrink it to the correct size - the clientHeight value comes back as the full size of the…
DisgruntledGoat
  • 70,219
  • 68
  • 205
  • 290
391
votes
13 answers

Should I size a textarea with CSS width / height or HTML cols / rows attributes?

Every time I develop a new form that includes a textarea I have the following dilemma when I need to specify its dimensions: Use CSS or use the textarea's attributes cols and rows? What are the pros and cons of each method? What are the semantics of…
Pherrymason
  • 7,835
  • 8
  • 39
  • 57
370
votes
23 answers

Why is textarea filled with mysterious white spaces?

I have a simple text area in a form like this: I keep getting extra white…
Afamee
  • 5,160
  • 9
  • 38
  • 43
358
votes
15 answers

How to add a new line in textarea element?

I want to add a newline in a textarea. I tried with \n and
tag but are not working. You can see above the HTML code. Can you help me to insert a newline in a textarea?