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 9260673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:57:12+00:00 2026-06-18T12:57:12+00:00

I want to specially create hover and click effects for my buttons, but in

  • 0

I want to specially create hover and click effects for my buttons, but in a way that changes it for a different button than the one being hovered over, so I need to use JavaScript, not CSS.

I have the following jQuery:

    // Highlights Browse button when the user hovers over div.upload
    $(".upload").hover(
        function() {
            $("input[type='button']").addClass("browse-hover");
        },
        function() {
            $("input[type='button']").removeClass("browse-hover");
        }
    );

    // Darkens Browse button when user clicks on div.upload
    $(".upload").mousedown(function() {
        $("input[type='button']").addClass("browse-active");
    });

    $(".upload").mouseup(function() {
        $("input[type='button']").addClass("browse-active");
    });

With the following classes from my main CSS file being added:

.browse-hover {
    background: #9972ad; /* Old browsers */
    background: -moz-linear-gradient(top,  #9972ad 0%, #7a3e99 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#9972ad), color-stop(100%,#7a3e99)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  #9972ad 0%,#7a3e99 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  #9972ad 0%,#7a3e99 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  #9972ad 0%,#7a3e99 100%); /* IE10+ */
    background: linear-gradient(to bottom,  #9972ad 0%,#7a3e99 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9972ad', endColorstr='#7a3e99',GradientType=0 ); /* IE6-8 */
}

.browse-active {
    background: red;
}

HTML:

<div class="upload-form">
            <form action="" method="post" enctype="multipart/form-data">
                <div class="upload">
                    <input type="file" name="file-input">
                     <span class="input-filename">Select a file...</span>
                     <input type="button" value="Browse">
                </div>

                <input type="submit" name="submit" value="Upload">
                <span class="valid-formats">Valid input: .txt files &lt;= 512 KB</span>
            </form>
        </div>

I’m using addClass() in a way that should overwrite the previous values, as there’s a background set before (gradient) that I’m changing on hover. It just isn’t working whatsoever. It’s wired up properly, if I click with an alert set it will execute properly.

  • 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-18T12:57:13+00:00Added an answer on June 18, 2026 at 12:57 pm

    Button is a child of upload so you can go full CSS and try that:

    .upload:hover input[type='button'] { /* style */ }
    

    http://jsfiddle.net/bLXAy/2/

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

Sidebar

Related Questions

I want two special methods: one that runs for all URLs one that runs
i want that during marshelling special character should escape, is there any way to
Is there a way to create your own HTML element? I want to make
I'm planning to buy a cellphone, this one: http://www.forum.nokia.com/devices/5130_XpressMusic/ I want to create some
I want to create an Android application that is a client for an Internet
I want to create a template function that generates a string representation of an
There's a question that looks like this one here: Create my own classList object
I want to create a 'hidden custom cell' effect like that used in the
I want to create buttons like these: In modern browsers the effect is created
I want to create special text fields, with different background images, colors or sizes.

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.