Textarea cols attribute

Definition and Usage

cols attribute to set or return the value of the text area's cols attribute.

The HTML cols attribute specifies the visible width of the text area in characters.

Tip:You can also use style.width attribute to set the width of the text area.

Tip:Use rows attribute or style.height Use the attribute to change the height of the text area.

See also:

HTML Reference Manual:HTML <textarea> cols প্রতিশব্দ

Example

Example 1

Change the width of the text area:

document.getElementById("myTextarea").cols = "100";

Try it yourself

Example 2

Get the width of the text area in characters:

var x = document.getElementById("myTextarea").cols;

Try it yourself

Example 3

Use style.width attribute to change the width of the text area:

document.getElementById("myTextarea").style.width = "500px";

Try it yourself

Example 4

Use cols and rows attributes to change the width and height of the text area:

document.getElementById("myTextarea").cols = "100";
document.getElementById("myTextarea").rows = "10";

Try it yourself

Example 5

Use style.width and style.height attributes to change the width and height of the text area:

document.getElementById("myTextarea").style.width = "500px";
document.getElementById("myTextarea").style.height = "100px";

Try it yourself

Syntax

Return cols attribute:

textareaObject.cols

set cols attribute:

textareaObject.cols = number

প্রতিশব্দ

মান বর্ণনা
number টেক্সট এরিয়ার প্রস্থতা নির্দেশ করে (গড় অক্ষর প্রস্থতা দিয়ে)।ডিফল্ট মান 20।

প্রযুক্তিগত বিবরণ

ফলাফল: সংখ্যা, টেক্সট এরিয়ার প্রস্থতা নির্দেশ করে, অক্ষর ইউনিটে।

ব্রাউজার সমর্থন

চ্রোম এজ ফায়ারফক্স স্যাফারি ওপেরা
চ্রোম এজ ফায়ারফক্স স্যাফারি ওপেরা
সমর্থন সমর্থন সমর্থন সমর্থন সমর্থন