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

  • Home
  • SEARCH
  • 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 7736661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:47:47+00:00 2026-06-01T07:47:47+00:00

I am new to Jquery. I have an upload form that when something is

  • 0

I am new to Jquery. I have an upload form that when something is uploaded the upload-button changes class from:

<a class="upload-button upload buy" id="upload-button"><span>Upload a document</span></a>

To:

<a class="upload-button buy white" id="upload-button"><span>Upload a document</span></a>

I have tried to write a function that adds a div called ‘done’ if a file has already been uploaded(the class in the button has changed).

Here is what I have got so far:

$('a#upload-button').ready(function() {
            if ($(this).hasClass('white')) {
                $('#three')
                    .append('<div class="done rotateone wiggler"></div>')
                    .addClass('grey');
        }
        })

I am not sure why it is not working. Please could somebody help?

  • 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-01T07:47:48+00:00Added an answer on June 1, 2026 at 7:47 am

    You should do (if you want to check if a button has a class when the page is loaded, otherwise just take the if part and put it where you need it

    //this is a shorthand methot for $(document).ready() 
    //you should use this to wait for the dom to load
    $(function(){
     //if the link has the class
      if($('a#upload-button').hasClass('white')){
         //append the button
         $('#three')
            .append('<div class="done rotateone wiggler"></div>')
            .addClass('grey');
      }
    });
    

    EDIT – you should modify your script

    function verifyFileUploadState(up) {
        if ($(".file-title").length == 0) {
            $("#upload-button span").html("Upload a document");
            $("#upload-button").addClass("upload");
            $("#upload-button").removeClass("white");
        } else {
            $("#upload-button span").html("Upload another document");
            $("#upload-button").removeClass("upload");
            $("#upload-button").addClass("white");
             $('#three')
                .append('<div class="done rotateone wiggler"></div>')
                .addClass('grey');
        }
        up.refresh();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am somewhat new to jQuery and I have a problem with something I
I have application that brings response via Ajax and creates 5-20 new jQuery click
I'm new to jQuery and I want to have a input box from a
I'm new to JQuery and was wondering how can I have Changes saved! displayed
I have a simple form that generates a new photo gallery, sending the title
I'm coding a form using PHP and jQuery. I have a file upload field
I have implemented upload feature in ASP.MVC. I am using jQuery.BlockUI and JQuery.Form plugins
I am using the jQuery form validation plugin. The problem I have is that
I am new to jQuery and have run into a problem. I have a
hey people I'm new at jquery and i have been trying to figure this

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.