Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8227825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:15:31+00:00 2026-06-07T16:15:31+00:00

my reset button is able to work but in my sample form, I have

  • 0

my reset button is able to work but in my sample form, I have two files to reset them individually. Now when i press my reset button, it will reset two fields.I can’t use form.reset() to call out because I won’t want to reset my whole form values. So if I have two files selected for browse and browseAssign and I click cancel. Both values gone.

Updated Code:
<form name = "sample" id = "sample" action ="nextpage.php">
<input name="Name" type="text" id="Name" value="Joey"/>
<input name="browse" type="file"/>
<button type="reset" title="Cancel" onClick="document.getElementsByName('browse').value=''"><span>cancel</span></button>

<input name="browseAssign" type="file"/>
<button type="reset" title="Cancel" onClick="document.getElementsByName('browseAssign').value=''"><span>cancel</span></button>

</form>

It still reset two browse fields.Kindly advise.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:15:34+00:00Added an answer on June 7, 2026 at 4:15 pm

    Use this:

    <form name="sample" id="sample" action="nextpage.php">
    <input name="Name" type="text" id="Name" value="Joey" />
    <input id="browse" name="browse" type="file" />
    <button title="Cancel" onclick="event.preventDefault();document.getElementById('browse').value='';"><span>cancel</span></button>
    <input id="browseAssign" name="browseAssign" type="file" />
    <button title="Cancel" onclick="event.preventDefault();document.getElementById('browseAssign').value='';"><span>cancel</span></button>
    </form>
    

    How it works: add IDs to the file inputs, then in the onclick event, prevent the default action (submitting the form) and then reset the value of the input in question to ''.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please how can i make the submit button and reset button have a different
HTML has an input button type to reset all fields in a form to
I have an html form in a view that needs to be reset from
I have been trying to use JScrollPane with my applet, but it doesn't work.
i'm using a QR Code SDK when pressed the button, it will have a
i have a form with 2 fields username: password: and a submit button. the
I'm trying to use the form_for reset button: <%= button_tag 'Reset', :type => 'reset'
In the script below, the reset button acts also like a submit button. Where
I am trying to reset the UIPickerView on button click. My pickerview id is
I can use .button() to create beautiful submit buttons, but the rest of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.