In order to disable a textarea (or any other input element), you can:
-
In HTML, you can write:
<textarea id='mytextarea' disabled></textarea> -
From jQuery, you can:
$("#mytextarea").attr("disabled","disabled"); -
CSS? Is it possible to disable the textarea with CSS?
You can make a textarea appear disabled, but you can’t actually disable it.
Using JavaScript, all you’re really doing is modifying the same DOM attribute that’s set by the HTML
disabledattribute, so using HTML and JavaScript you’re essentially doing the same thing. CSS, however, is completely out of this picture, as it doesn’t do DOM manipulation of any sort — all it controls is the appearance (visual or otherwise) of an element, not its behavior.