Textarea placeholder Property - Get the placeholder text of a text area: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Textarea

Description

Textarea placeholder Property - Get the placeholder text of a text area:

Demo Code

ResultView the demo in separate window

<!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() {/* w w w  .  j av  a2  s .c  o m*/
    var x = document.getElementById("myTextarea").placeholder;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials