cols property (textarea)
Specifies or returns the width of a textarea, in characters.
The width is determined by the average character width. You can set the dimensions of the textarea with the width and the height style properties.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: cols |
Possible values:
Integer that sets or retrieves the width in characters.
Default: 20.
Example HTML code 1:
This example illustrates the use of the cols attribute:
|
||||
<textarea cols="40"> The cols attribute of the textarea element sets the width of the object. </textarea> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the cols property:
|
||||
<head> <script type="text/javascript"> function ChangeCols () { var textarea = document.getElementById ("myText"); var input = document.getElementById ("myInput"); textarea.cols = input.value; } </script> </head> <body> <textarea id="myText" cols="40"> The cols attribute of the textarea element sets the width of the object. </textarea> <br /> <input type="text" id="myInput" value="20" /> <button onclick="ChangeCols ();">Change cols attribute!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
HTML elements:
Related pages:
External links:
User Contributed Comments