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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:05:03+00:00 2026-05-21T12:05:03+00:00

I have a list, with each list element having a textarea and an img.

  • 0

I have a list, with each list element having a textarea and an img. When I hover over one of the list’s textareas, I want the respective img to change src.

The problem is that when I hover over a textarea on one of the lists, all the imgs on the list change, not just the one on that list item.

$('.rightMainP').hover(function() {
    $('#rightMain').find('img:first-child').attr('src', '../Images/whiteSidewaysNub.png');
}, function() {
    $('#rightMain').find('img:first-child').attr('src', '../Images/graySidewaysNub.png');
});

In my code, there are multiple imgs in each list item, and my jquery can not specify to only change the one in the list item that has the textarea that is being hovered over.

  • 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-21T12:05:04+00:00Added an answer on May 21, 2026 at 12:05 pm

    You need to select the <img> which is inside the same list element as the <textarea> you hover on. This should do it:

    $('.rightMainP').hover(function() {
        $(this).closest('li').find('img').attr('src', '../Images/whiteSidewaysNub.png');
    }, function() {
        $(this).closest('li').find('img').attr('src', '../Images/graySidewaysNub.png');
    });
    

    Whenever the hover event is triggered, the attribute change is performed on all images which are descendants of the same list element that the hovered textarea is a descendant of. That should be just one image.

    If the textareas and images are actually children of the same element (i.e. they are siblings), then you can also use

    $('.rightMainP').hover(function() {
        $(this).siblings('img').attr('src', '../Images/whiteSidewaysNub.png');
    }, function() {
        $(this).siblings('img').attr('src', '../Images/graySidewaysNub.png');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list with length N and each element of this list are
I have a list, each item of which has several things in it, including
I have a list of objects, each containing an Id, Code and Description. I
I have a List of beans, each of which has a property which itself
I have a list of records in my database and each record is associated
I have a list of articles, and each article belongs to a section. class
I have a List, it has Foo objects, and each Foo has a start
I have a list of values that I am looping through, determining whether each
I have two lists of objects. Each list is already sorted by a property
I have a big list of global variables that each have their own setup

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.