Answers for "reset input type file"

2

javascript set file input value to null

document.getElementById("myInputFileID").value=null;
Posted by: Guest on February-20-2020
2

javascript clear file input

document.getElementById("myFileInputID").value = null;
Posted by: Guest on August-01-2019
0

react reset file input

functionThatResetsTheFileInput() {
  let randomString = Math.random().toString(36);

  this.setState({
    theInputKey: randomString
  });
}

render() {
  return(
    <div>
      <input type="file"
             key={this.state.theInputKey || '' } />
      <button onClick={this.functionThatResetsTheFileInput()} />
    </div>
  )
}
Posted by: Guest on March-10-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language