HTML DOM Textarea defaultValue प्रॉपर्टी किसी HTML दस्तावेज़ में टेक्स्ट क्षेत्र तत्व के नाम विशेषता के मान को लौटाती है और संशोधित करती है।
सिंटैक्स
निम्नलिखित वाक्य रचना है -
<मजबूत>1. लौटने का नाम
object.name
<मजबूत>2. नाम जोड़ा जा रहा है
object.name = “text”
आइए HTML DOM Textarea नाम संपत्ति का एक उदाहरण देखें:
उदाहरण
<!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;
}
.show {
font-size: 1.5rem;
margin: 1rem 0;
}
</style>
<body>
<h1>DOM Textarea name Property Demo</h1>
<textarea rows="5" cols='20' name="I'm name attribute of textarea element">
Hi! I'm a textarea element with some dummy text.
</textarea>
<button onclick="set()" class="btn">Show Name Attribute Value</button>
<div class='show'></div>
<script>
function set() {
document.querySelector('.show').innerHTML = document.querySelector("textarea").name;
}
</script>
</body>
</html> आउटपुट

“नाम विशेषता मान दिखाएं . पर क्लिक करें textarea तत्व की नाम विशेषता का मान प्रदर्शित करने के लिए बटन।
