Textarea rows Property
Example
Change the number of visible rows for a text area:
Definition and Usage
The rows property sets or returns the value of the rows attribute of a text area.
The rows attribute specifies the height (visible number of lines) in a text area.
Tip: You can also use the style.height property to set the height of a text area.
Tip: Use the cols property, or the style.width property to change the width of a text area.
Browser Support
Property | |||||
---|---|---|---|---|---|
rows | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the rows property:
Set the rows property:
Property Values
Value | Description |
---|---|
number | Specifies the visible number of rows in the text area |
Technical Details
Return Value: | A Number, representing the height of the text area, in characters |
---|
More Examples
Example
Get the height of a text area, in characters:
The result of x will be:
Example
Change the height of a text area using the style.height property:
Example
Change the height and width of a text area using the cols and rows properties:
document.getElementById("myTextarea").cols = "100";
Example
Change the height and width of a text area using the style.width and style.height properties:
document.getElementById("myTextarea").style.width = "500px";
Related Pages
HTML reference: HTML <textarea> rows attribute
Textarea Object