clear input field value javascript

JavaScript
<!--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>
Source

Also in JavaScript: