Change the number of visible rows for a text area:
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.
The rows property is supported in all major browsers.
Return the rows property:
Set the rows property:
Value | Description |
---|---|
number | Specifies the visible number of rows in the text area |
Return Value: | A Number, representing the height of the text area, in characters |
---|
Get the height of a text area, in characters:
The result of x will be:
Change the height of a text area using the style.height property:
Change the height and width of a text area using the cols and rows properties:
Change the height and width of a text area using the style.width and style.height properties:
HTML reference: HTML <textarea> rows attribute