How to reset <input type = “file”> using javascript?

0 votes

I want to reset the contents of my file input:

<input type="file" id="uploadCaptureInputFile" class="win-content colors" accept="image/*" />

How should I do that?

Sep 18 in Java-Script by kartik
• 30,230 points
107 views

1 answer to this question.

0 votes

Hello @kartik,

You need to wrap <input type = “file”> in to <form> tags and then you can reset input by resetting your form:

onClick="this.form.reset()"

Hope it helps!!
Thank You!!

answered Sep 18 by Niroj
• 65,500 points

Related Questions In Java-Script

0 votes
1 answer

How to set Value of Input Using Javascript Function?

Hello @kartik, Try for YUI Dom.get("gadget_url").set("value",""); with normal Javascript document.getElementById('gadget_url').value = ''; with ...READ MORE

answered Oct 7 in Java-Script by Niroj
• 65,500 points
31 views
0 votes
1 answer

How to Scroll to the top of the page using JavaScript?

Hii @kartik, Using javascript <script> $("a[href='#top']").click(function() { ...READ MORE

answered Apr 2 in Java-Script by Niroj
• 65,500 points
73 views
0 votes
1 answer

How to parse Excel file in Javascript/HTML5?

Hello @kartik, Below Function converts the Excel sheet ...READ MORE

answered Jun 19 in Java-Script by Niroj
• 65,500 points
3,098 views
0 votes
1 answer

How to access PHP var from external javascript file?

Hello @kartik, You don't really access it, you ...READ MORE

answered Jul 6 in Java-Script by Niroj
• 65,500 points
496 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18 in Laravel by Niroj
• 65,500 points
2,674 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18 in Laravel by Niroj
• 65,500 points
322 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23 in Laravel by Niroj
• 65,500 points
220 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23 in Laravel by Niroj
• 65,500 points
3,325 views
0 votes
1 answer
0 votes
1 answer

How to get the file name from a full path using JavaScript?

Hello @kartik, Use this: var filename = fullPath.replace(/^.*[\\\/]/, '') This ...READ MORE

answered Sep 2 in Java-Script by Niroj
• 65,500 points
65 views