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

"प्लेसहोल्डर दिखाएं . पर क्लिक करें प्लेसहोल्डर विशेषता का मान प्रदर्शित करने के लिए बटन।
