Javascript examples for DOM HTML Element:Textarea
The placeholder property sets or gets the placeholder attribute of a text area.
Set the placeholder property with the following Values
Value | Description |
---|---|
text | Sets a short hint that describes the expected value of the text area |
A String, representing a short hint that describes the expected value of the text area
The following code shows how to change the placeholder text of a text area:
<!DOCTYPE html> <html> <body> Address:<br> <textarea id="myTextarea" placeholder="Your address.."> </textarea> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w w w.java2 s. co m document.getElementById("myTextarea").placeholder = "your address"; } </script> </body> </html>