Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

clear input field data on button click

<button type="button" onclick="ClearFields();">Clear</button>

function ClearFields() {

     document.getElementById("textfield1").value = "";
     document.getElementById("textfield2").value = "";
}
Comment

clear input field javascript

<form id="myForm">
  First name: <input type="text" name="fname" value="Demo"><br>
  Last name: <input type="text" name="lname"><br><br>
    <input type="file" name="Photo" class=" custom-file-input" id="photo">
  <input type="button" onclick="myFunction()" value="Reset form">
</form>
     
<script>
function myFunction() {
    document.getElementById("myForm").reset();
}
</script>
 Run code snippetHide results
Comment

PREVIOUS NEXT
Code Example
Javascript :: mongoose undo delete 
Javascript :: show more vs editor shortcut key 
Javascript :: form handling in next js 
Javascript :: validator.contains 
Javascript :: javascript pure ajax promise 
Javascript :: on device size changes react-multi-carousel items not showing 
Javascript :: scriptcase javascript close modal form 
Javascript :: change previous location history javascript 
Javascript :: flutter enum to json 
Javascript :: update on zoom is not working google-map-react 
Javascript :: javascript use numbers as objects 
Javascript :: what is the opposite of lazy initialization 
Javascript :: EventEmitter to emit a custom event 
Javascript :: H.C.F Calculation Program 
Javascript :: js hk 
Javascript :: &amp;&amp; in react jsx 
Javascript :: math.factorial javascript 
Javascript :: Function As Parameter In Self Invoking Function 
Javascript :: destructuring function nested parameters 
Javascript :: js rotate matrix 
Javascript :: GridFs Schema 
Javascript :: class parent and class child 
Javascript :: Backbone Save Example 
Javascript :: unreachable code detected javascript 
Javascript :: change jquery to javascript 
Javascript :: getters javascript 
Javascript :: javascript get object list by value 
Javascript :: Is It Negative Zero (-0)? js 
Javascript :: django ajax json data become string 
Javascript :: remove element 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =