Input Text value Property - Get the value of a text field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Text

Description

Input Text value Property - Get the value of a text field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Name: <input type="text" id="myText" value="Mickey">

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

<script>
function myFunction() {/*from  w ww .  j a  v  a 2 s.  c o m*/
    var v = document.getElementById("myText").value;
    console.log(v);
}
</script>

</body>
</html>

Related Tutorials