HTML DOM Textarea 属性
HTML DOM Textarea disabled 属性返回和修改 HTML 文档中的文本区域元素是否已禁用。
语法
语法如下:-
1. 返回禁用
object.disabled
2. 添加禁用
object.disabled = true | false
让我们看一个 HTML DOM Textarea disabled 属性的示例
示例
<!DOCTYPE html>
<html>
<style>
body {
color: #000;
background: lightseagreen;
height: 100vh;
}
.btn {
background: #db133a;
border: none;
height: 2rem;
border-radius: 2px;
width: 40%;
display: block;
color: #fff;
outline: none;
cursor: pointer;
}
</style>
<body>
<h1>DOM Textarea disabled Property Demo</h1>
<textarea placeholder="Hi! I'm placeholder text of a textarea element" rows="8" cols='20'></textarea>
<button onclick="set()" class="btn">Disable Textarea</button>
<script>
function set() {
document.querySelector("textarea").disabled = true;
}
</script>
</body>
</html>输出

点击“禁用文本区域”按钮以禁用文本区域元素。

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP