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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:05:25+00:00 2026-06-01T11:05:25+00:00

I have <span> inside a <div> , like so: <div id=#mydiv> <a href=#>Hello</a><span class=myImageArea></span>

  • 0

I have <span> inside a <div>, like so:

<div id="#mydiv">
<a href="#">Hello</a><span class="myImageArea"></span>
    <div class="someClass">
    </div>
</div>                          

With the following CSS:

.myImageArea {  
    background: url("../img/upArrow.png") no-repeat right 5px;
    display: inline-block;
    cursor: pointer;
}

I want to change the attribute background:url of class myImageArea

$('#mydiv').click(function() {
    //change the background image of the class
});

How can this be done?

  • 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-01T11:05:26+00:00Added an answer on June 1, 2026 at 11:05 am

    Within the click function you get a reference to the element you’ve clicked on, using jQuery’s selectors, you can now search inside that for the span. Once you have that you can then change the CSS property ‘background-image’:

    $('#myDiv').click(function() {
        $('.myImageArea', this).css('background-image', 'newimagepath.png');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple containers like this <div class=container> <span> <!-- Inside the span is
Folks, Let's say that I have the following situation: <div class=outer> <div> <span> <ul>
i have many controls like below : <div style=display: inline;> <span id=cvCaptcha-Target class=ttTarget> <asp:CustomValidator
Lets say that I have a HTML that looks like this: <div class=aaa><span>1</span></div> <div
I have a set of nested elements like such. <div id=master> <span id=num-1 class=num></span>
I have a .net textbox (text area) inside a div like this: <div class=description-textarea>
I have the following: <div class=btn-group> <input disabled=disabled id=dialogType> <button data-toggle=dropdown class=dropdown-toggle> <span class=caret></span>
I have a div that has a span inside that will display a message
I have a span that is generated through javascript, with its css class as
How to hide part of the text inside div or span ? I have

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.