Input Number placeholder Property - Display the placeholder text of a number field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Number

Description

Input Number placeholder Property - Display the placeholder text of a number field

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="number" id="myNumber" placeholder="Favorite Number">

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//from w  w w .  j  a  v a 2 s . com
    var x = document.getElementById("myNumber").placeholder;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials