Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

reset input react

const App = () => {
  const [message, setMessage] = useState('');
  return (
    <div>
      <input
        type="text"
        value={message}
		onChange={(event) => {
          setMessage(event.target.value);
        }}/>

      <button 
		onClick={() => {
          alert('check')
          // clear input value
          setMessage('');
        }}>
          Clear field
      </button>
    </div>
  );
};
Comment

reset form input react

cancelCourse = () => { 
  document.getElementById("create-course-form").reset();
}

render() {
  return (
    <form id="create-course-form">
      <input />
      <input />
      ...
      <input />
    </form>
  );
}
Comment

reset form in react

<!-- you just need a button type of reset -->
<form>
  <div>
   <label for="name">Name</label>
   <input type="text" id="name" placeholder="name" />
  </div>
  <div>
   <label for="password">Password</label>
   <input type="password" id="password" placeholder="password" />
  </div>
  <button type="reset">Reset</button> 
  <button>Submit</button>
</form>
Comment

PREVIOUS NEXT
Code Example
Javascript :: all input value empty jquery 
Javascript :: express js npm 
Javascript :: smooth scroll safari 
Javascript :: jquery when iframe is loaded 
Javascript :: math round 
Javascript :: cypress check attribute for each element 
Javascript :: onclick function jquery 
Javascript :: js find index in list 
Javascript :: largest number javascript 
Javascript :: webpack sass 
Javascript :: clear html element javascript 
Javascript :: angular 2 reactive forms radio button by default checked 
Javascript :: bootstrap datepicker mindate 
Javascript :: javas script add list 
Javascript :: check if object has key lodash 
Javascript :: conditional style react native 
Javascript :: npm verbose stack error 
Javascript :: react cheat sheet 
Javascript :: how to get number of a specific element of an array 
Javascript :: modulus of negative numbers 
Javascript :: json example 
Javascript :: express middleware logging 
Javascript :: array push method 
Javascript :: display amount with currency for jquery 
Javascript :: js create object from array 
Javascript :: electron hide devtools 
Javascript :: js sort letters 
Javascript :: js custom event 
Javascript :: javascript regex example match 
Javascript :: javascript callback 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =