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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:35:00+00:00 2026-05-12T22:35:00+00:00

Im kinda new to Jquery, so this might be easy, then again i cant

  • 0

Im kinda new to Jquery, so this might be easy, then again i cant seem to find anything on Google. So here goes.

I basically have this:

<div>
    <div id="row1" class="col1" onMouseOver="OnMouseOver(11)">
         I dont want to select this
    </div>
    <div id="row1" class="col2" onMouseOver="OnMouseOver(12)">
         I want to select this
    </div>
    <div id="row2" class="col1" onMouseOver="OnMouseOver(21)">
         I dont want to select this
    </div>
    <div id="row2" class="col2" onMouseOver="OnMouseOver(22)">
         I dont want to select this
    </div>
</div>

and i want to select just the one div(eg. #row1 .col2) to change the css background image, but i cant get it to work.
As it is i have a switch/case block that chooses which div to select.

i have tried different variaties of this selection:

$('#row1').find(".col1").css('background-image', 'url(Images/LosCol1Over.png)')

also

$('#row1','.col2').css('background-image','url(Images/LosCol1Over.png)')

and several other combi i can remember

I think the problem is compounded(or confounded maybe :D) by the fact that the columns have the same background-image and this is set in the css by

.col1{
    background-image: url(Images/LosCol1.png)
}    
.col2{
    background-image: url(Images/LosCol1.png)
}

Any ideas?

  • 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-12T22:35:01+00:00Added an answer on May 12, 2026 at 10:35 pm

    The class should be smack up against the #id selector like this:

    $('#row1.col2').css('background-image','url(Images/LosCol1Over.png)');
    

    But you really shouldn’t ever have more than one element with a unique id. Perhaps you should designate the rows as additional classes so:

    <div class="row1 col1"...
    <div class="row1 col2"...
    

    You could then select it like this:

    $('.row1.col2').css('background-image','url(Images/LosCol1Over.png)');
    

    Edit:

    The reason the code you tried failed are for these reasons:

    1. In your first example, you select a div#row1 with your initial $('#row1') and then try to use .find('.col1') to select the correct one. This will not work because find looks through descendants of the selected element, not the element itself. By using $('#row1.col1') instead, you are saying you want the #row1 that has the .col1 class.
    2. In your second example, you have your parameters reversed and still have the problem of your first example. The correct order is $(selector, scope) where scope is the element that you want to restrict the search to instead of looking through the whole document. You used $('#row1', '.col1') which would look for a element with the id of row1 inside any element matching .col1. Of course looking for .col1 inside of #row1 would still be the same problem as your first example.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It may seem to be very easy for you guys but I'm kinda new
I'm kinda new to jQuery, so this may be a silly question... My problem
I'm new to jquery and I kinda don't get around this. So I have
I'm kinda new to jQuery and I did get the toggle function to work
I am kinda new to this Regex thing. When analyzing some code I frequently
I'm kinda new to jquery and I have created an hide/show animation for a
I'm kinda new to jQuery and JS and i'm trying to make a text-size
I am new to jQuery and I came across a Problem with the find
I think this might be a passing the argument problem, but I'm still new
Kinda New to Jquery and hit an issue regarding returned HTML. I am using

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.