---
title: "How to disable a text area?"  
description: "How to disable a text area?"  
author: "Steilla Mitchel"  
published: 2023-07-21  
updated: 2023-07-21  
canonical: https://www.mindstick.com/forum/159194/how-to-disable-a-text-area  
category: "html"  
tags: ["html", "html input"]  
reading_time: 2 minutes  

---

# How to disable a text area?

How to [disable](https://www.mindstick.com/forum/12901/how-to-disable-enable-input-box-in-aspx-with-value-from-sql) a [text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions) area?

## Replies

### Reply by Aryan Kumar

There are two ways to disable a text area in HTML:

- **Using the** `disabled` **attribute**

The `disabled` attribute is a boolean attribute. When present, it specifies that the element should be disabled. A disabled element cannot be interacted with by the user.

To disable a text area using the `disabled` attribute, add the `disabled` attribute to the `textarea` element and set its value to `true`.

HTML

```plaintext
<textarea disabled></textarea>
```

- **Using the JavaScript** `disabled` **property**

The JavaScript `disabled` property is a boolean property. It can be used to set or get the disabled state of an element.

To disable a text area using JavaScript, you can use the following code:

JavaScript

```plaintext
const textarea = document.querySelector('textarea');
textarea.disabled = true;
```

This code will disable the text area with the ID `textarea`.

Here are some additional things to keep in mind when disabling text areas:

- **Disabled text areas do not have the focus ring.** The focus ring is the outline that appears around an element when it is focused. Disabled text areas do not have the focus ring, so it is not possible to focus on them.
- **Disabled text areas do not submit their value when the form is submitted.** If you have a text area in a form and you disable the text area, the value of the text area will not be submitted when the form is submitted.


---

Original Source: https://www.mindstick.com/forum/159194/how-to-disable-a-text-area

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
