why use document.getelementbyid to set value of input code example Example: set value using javascript document.getElementById("myText").value = "your string";