Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

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>
 
PREVIOUS NEXT
Tagged: #clear #button #javascript
ADD COMMENT
Topic
Name
9+7 =