value for input in javascript using DOM code example Example: js input value var x = document.getElementById("myText").value;