The disabled attribute is a boolean attribute. When present, it specifies that the text area should be disabled. A disabled text area is unusable and the text is not selectable (cannot be copied).
You can set the size of a text area using the cols and rows attributes. To limit the number of characters entered in a textarea, use the maxlength attribute. The value if the attribute is in number. Specifies that on page load the text area should automatically get focus.
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 is specified by the <cols> and <rows> attributes (or with CSS).
Try this CSS to disable resizing
The CSS to disable resizing for all textareas looks like this:
textarea {
resize: none;
}
You could instead just assign it to a single textarea by name (where the textarea HTML is ):
textarea[name=foo] {
resize: none;
}
Or by id (where the textarea HTML is ):
#foo {
resize: none;
}
Taken from: http://www.electrictoolbox.com/disable-textarea-resizing-safari-chrome/
this will do your job
textarea{
resize:none;
}
CSS3 can solve this problem. Unfortunately it's only supported on 60% of used browsers nowadays.
For IE and iOS you can't turn off resizing but you can limit the textarea
dimension by setting its width
and height
.
/* One can also turn on/off specific axis. Defaults to both on. */
textarea { resize:vertical; } /* none|horizontal|vertical|both */
See Demo
Just one extra option, if you want to revert the default behaviour for all textareas in the application, you could add the following to your CSS:
textarea:not([resize="true"]) {
resize: none !important;
}
And do the following to enable where you want resizing:
<textarea resize="true"></textarea>
Have in mind this solution might not work in all browsers you may want to support. You can check the list of support for resize
here: http://caniuse.com/#feat=css-resize
As per the question, i have listed the answers in javascript
By Selecting TagName
document.getElementsByTagName('textarea')[0].style.resize = "none";
By Selecting Id
document.getElementById('textArea').style.resize = "none";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With