e.target.value = null;
<input onChange={this.onChange} onClick={e => (e.target.value = null)} type="file" />
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>
)
}
Code Example |
---|
Html :: onsubmit in html |
Html :: html img tag with alt |
Html :: bootstrap 5 list |
Html :: html bullet symbol |
Html :: rating star |
Html :: select add placeholder |
Html :: yellow html |
Html :: HTML Links - Different Colors |
Html :: html email link |
Html :: html umlaute |
Html :: embed tag in html |
Html :: how to add js to html |
Html :: why is html so easy |
Html :: links html |
Html :: ionic skeleton |
Html :: html table cell full width |
Html :: flutter web load html |
Html :: whatsapp api |
Html :: video html player |
Html :: html to pdf angular |
Html :: remove cell border css |
Html :: jsp variable in html |
Html :: html code for writing text |
Html :: a tag onclick |
Html :: what is rc in version |
Html :: inserting a page break in markdown |
Html :: title in html |
Html :: input type password show asterisk |
Html :: tailwind rounded top left |
Html :: make a div clickable |