how to view the answer of a js function in a html input? [duplicate]
Is this what you want to do? function myFunction() { // some functionality here // this function must return something } var input = document.querySelector(‘input’); input.value = myFunction(); This will set the value of the input element to the value returned by myFunction.