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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:38:53+00:00 2026-05-29T21:38:53+00:00

Why won’t this jQuery change my image to a down arrow like I want

  • 0

Why won’t this jQuery change my image to a down arrow like I want it to? When a user opens a drop down, the up arrow changes to a down arrow. I’m doing this with an if else because I don’t know any easier way, but it’s not working. The arrow stays up the entire time, no matter how many times I click. Here is the jQuery. Should be all thats needed. Thanks!

    $("h3#mpcClients").click(function() {
            $("#hidden0").slideToggle(500); 

            var up = true;

            if (up == true) {

            $("td h3").css("background-image", "url(http://www.crm-newsletter.com/client-emails/images/arrowDown.png)");
            up=false;
          }
            else if(up == false) {
                $("td h3").css("background-image", "url(http://www.crm-newsletter.com/client-emails/images/arrowUp.png)");
            up=true;
            }
            });
  • 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-05-29T21:38:54+00:00Added an answer on May 29, 2026 at 9:38 pm

    See .toggleClass() and set up some css like so:

    .up {
        background-image: url("http://www.crm-newsletter.com/client-emails/images/arrowDown.png")
    }
    .down {
        background-image: url("http://www.crm-newsletter.com/client-emails/images/arrowDown.png")
    }
    

    Make sure you set up the html to a default arrow direction like so:

    <td>
        <h3 class="up">Some text</h3>
    </td>
    

    Now for the js to change the css classes of the element:

    $("h3#mpcClients").click(function() {
            $("#hidden0").slideToggle(500);
    
            // This adds a class if the element doesn't already have it
            // if the element already has the class it will remove it.
            $("td h3").toggleClass("up down"); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Godaddy won't enable mod_gzip for me, so I have to use headers like this:
Why won't this work? I would like it to print every second. Thanks. import
Why won't this send the user to user.php if the ID don't exist in
My code won't compile. What am I doing wrong? I'd also like the sf::Window
Why won't this xml schema validate ? Visual studio says that the simpleContent tag
why won't this work? function login(){ if(window.XMLHttpRequest){ ajax=new XMLHttpRequest(); }else if(window.ActiveXObject){ ajax=new ActiveXObject(Microsoft.XMLHTTP); }
Why won't this work? public static int[] GetListOfAllDaysForMonths() { static int[] MonthDays = new
I won't use GIcon to change for the marker.Any other ways to change color
Won't the union in this question cause UB when used as this: union Data
Why won't first div in this html display as a column next to 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.