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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:25:52+00:00 2026-06-07T22:25:52+00:00

Can someone please help me understand why this code is not working? $(‘#quick-search-header.widget-title’).css(‘background-image’, ‘url(dd_includes/images/icons/sliding-menu-arrow-right.gif)’);

  • 0

Can someone please help me understand why this code is not working?

$('#quick-search-header.widget-title').css('background-image', 'url(dd_includes/images/icons/sliding-menu-arrow-right.gif)');

I see through Firebug that the background-image has been removed entirely from #quick-search-header.widget-title, but the new background image above is added to element.style. Thanks.

HTML –

<div id="quick-search-header" class="widget-title">
    <p>Quick search results</p>
</div>

CSS –

#quick-search-header.widget-title{
    background: #C60B46 url(dd_includes/images/icons/sliding-menu-arrow-down.gif) right 3px no-repeat;
}

Full JS (with error code marked) –

$(document).ready(function(){

    $('input#s').val('');

    $('#quick-search-header.widget-title').live('click', function(){

        if($('#quick-search-content').hasClass('visible')){

            $('#quick-search-header.widget-title').css('background-image', 'url(dd_includes/images/icons/sliding-menu-arrow-right.gif)'); /** Not working */
            $('#quick-search-content').removeClass('visible')
            $('#quick-search-content').slideUp('600');

        } else {

            $('#quick-search-header.widget-title').css('background-image', 'url(dd_includes/images/icons/sliding-menu-arrow-down.gif)'); /** Not working */
            $('#quick-search-content').addClass('visible')
            $('#quick-search-content').slideDown('600');

        }

    });

});
  • 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-07T22:25:55+00:00Added an answer on June 7, 2026 at 10:25 pm

    Setting any value via the css('attributename','attributevalue') function in jQuery will add that attribute to the inline style of the element. In the inspector its often labeled element.style

    If you need to do this via classes only then you can create a seperate class with the alternate background image in and switch classes by adding/removing classes from the element, this would not appear in the element.style, rather it would just switch the class and that would be displayed in the inspector instead.

    You could even use the toggleClass() function which would allow you to toggle a particular or multiple classes on or off.

    Docs are as follows:

    toggleClass

    addClass

    removeClass

    Or you could even do it by setting an attribute on the element using .attr('class','newClassName');

    Up to you.

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

Sidebar

Related Questions

Someone please help me understand why this binding does not work... I have a
Can someone please help me understand why this bool isn't saving? Here is my
can someone please help me. why does this return an error: Dim stuff As
Can someone please help me out with a JavaScript/jQuery solution for this arithmetic problem:
Could someone please help explain why I can't get this to work? I properly
Please can someone help? I have the following code which uploads a file to
Can someone please help me understand the following: In the previous version of NHibernate
Can someone please help be take apart the elements here and help me understand
Could someone please help me to understand why the following block of code keeps
Can someone please help to clarify? Also, please mention if there are other representation

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.