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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:33:37+00:00 2026-06-07T02:33:37+00:00

I have many <div> tags separate from each other. They all have this layout:

  • 0

I have many <div> tags separate from each other. They all have this layout:

<div class="swatchimgouter">
    <div class="swatchimginner">
        <img src="myimage.jpg" alt="Green"/>
    </div>
</div>

<div class="swatchimgouter">
    <div class="swatchimginner">
        <img src="myimage.jpg" alt="Black"/>
    </div>
</div>

<div class="swatchimgouter">
    <div class="swatchimginner">
        <img src="myimage.jpg" alt="Red"/>
    </div>
</div>

<div class="swatchimgouter">
    <div class="swatchimginner">
        <img src="myimage.jpg" alt="White"/>
    </div>
</div>

Am wanting to get the "alt" attribute of the <img> when the swatchimgouter div is hovered. This event fires fine when hovered:

$("#variations div.swatchimgouter").mouseover(function () {

}

I’ve tried many combinations of selectors, but none of them are giving me access to the <img> attributes. Since there are many of these div tags with a class of swatchimgouter, and the one I want is the one that triggers the above mouseover event, do I use this somehow to get to the img? Something like:

var previewColor = $('div.swatchimginner img', this).attr('alt');
  • 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-07T02:33:39+00:00Added an answer on June 7, 2026 at 2:33 am

    Im not to sure what you have tried but your example is more or less working for me:

    $("#variations div.swatchimgouter").mouseover(function () {
        var previewColor = $('img', this).attr('alt');
        alert(previewColor);
    });
    

    demo: http://jsfiddle.net/JtQfh/

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

Sidebar

Related Questions

We have many links with rel attributes: <div class=team-tags> <a class=s1 rel=t1 t2 t3
I have many DIV with the same class name, let save wmplayer. I want
i have many div's with the same background image and i want change this
I have a div that contains many spans and each of those spans contains
From this XHTML source: <div class = page> <h1>UNIQUE NAME</h1> <table> <tbody> <tr> <td>DATA
I have many elements (floating href tags) in a div with a set height/width,
In my page I have many DIV and P tags, and I want to
I want to append a div inside a div which have many divs inside
I have a menubar(div) which houses bookmarks and when too many bookmarks are inserted
We have many projects with several files inside each. Files can be checked in

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.