<!--Clearing input field in javascript--> <input type="text" value="Blabla" id="myInput"> <button onclick="clear()">Clear input field</button> <script> function clear(){ document.getElementById('myInput').value = '' } </script>
Clear input field on focus <!-- When the input field gets focus, replace its current value with an empty string --> <input type="text" onfocus="this.value=''" value="The text">