<input id="text"> <button onclick="myFunction()">Run</button> <script> function myFunction() { document.getElementById("text").value = ""; } </script>