Input Button value Property - Get the text displayed on a button: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Button

Description

Input Button value Property - Get the text displayed on a button:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

Favorite car:/*from  w ww.j  a va  2  s  . com*/
<input type="button" id="myBtn" value="Volvo">

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

<script>
function myFunction() {
    var v = document.getElementById("myBtn").value;
    console.log(v);
}
</script>

</body>
</html>

Related Tutorials