How to Change Input Value in JavaScript?

  1. Get the input with document.getElementById() or document.querySelector().
  2. Append value to it with =.
document.getElementById('divId').value = "value";

Example:

<input id="myInput" type="text">

<script>
    document.getElementById('myInput').value = "New value";
</script>

Output: