Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript clear input string

 inputField.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

clear input value with javascript

inputField.value = " ";
Comment

PREVIOUS NEXT
Code Example
Javascript :: append a query string to the url react 
Javascript :: flatlist scrolltoend 
Javascript :: active nav links in next.js 
Javascript :: js page auto reload 
Javascript :: how to check how many strings are in a sentence javascript 
Javascript :: set label text in jquery 
Javascript :: npm registry 
Javascript :: n javascript 
Javascript :: react native onChangeText resize the background image 
Javascript :: how to generate random id in javascript 
Javascript :: iterate over map in javascript 
Javascript :: remove duplicates objects from array javascript 
Javascript :: how to check all values of an array are equal or not in javascript 
Javascript :: user focus on tab javascript 
Javascript :: page redirect after load 
Javascript :: how to add link to button in react js 
Javascript :: laravel react 
Javascript :: npm react dom routing 
Javascript :: ajax with progress bar 
Javascript :: js get element by X Y 
Javascript :: foreach loop javascript 
Javascript :: complex json example 
Javascript :: how to select div js 
Javascript :: javascript number between values 
Javascript :: how to collect keys using lodash javascript 
Javascript :: orbit controls drei 
Javascript :: javascript how to increment by other than one in for loop 
Javascript :: javascript timeout 
Javascript :: what indexof in javascript 
Javascript :: how to sort array without using sort method in javascript 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =