Answers for "how to get clear button"

0

how to make a clear button in javascript

<script>
  function clear_inputs(){
    inputs=document.getElementsByClassName('inputs')
    for(input of inputs){
    	input.value=' ' ///this emptys the inputs
    }
  }
</script>
<input class='inputs' type="text">
<input class='inputs' type="text">
<input class='inputs' type="text">

<button onclick='clear_inputs()'>Clear</button>
Posted by: Guest on May-27-2021

Browse Popular Code Answers by Language