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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:43:46+00:00 2026-06-03T01:43:46+00:00

I have the following HTML: <div id=showDropZone class=ui-droppable style=position: absolute; z-index: 1; outline-style: none;

  • 0

I have the following HTML:

<div id="showDropZone" class="ui-droppable" style="position: absolute; z-index: 1; outline-style: none; left: 0px; width: 379px; height: 500px;">
    <div id="introText" style="display: none;">Drag and drop program images here</div>
        <ul class="gallery ui-helper-reset">
            <li class="imgThumbLi ui-draggable imageSelected" title="File Name: drago.jpg Dimension: 225x225 Size: 7 KB" style="display: list-item;">
                <img class="image" src="/myApp/2012/5/1/1335900424140/39345e7f3d12487bb6e347e786194c9b" title="File Name: drago.jpg Dimension: 225x225 Size: 7 KB">
                <div class="imageInfo">
                    <p class="detailTitle">Logo!</p>
                </div>
            </li>
        </ul>
    </div>
</div>

In my jQuery/JS function I obtain the <ul> element (and its <li> children) and I can easily find the p.detailTitle‘s text value with the following code:

$("#showDropZone").find("ul").each(function() {
    $(this).find("li").each(function() {
        var detailTitle = $(this).find("p.detailTitle").text();

        // This prints "Logo!" correctly...
        alert(detailTitle);

        var imageTitle = $(this).find("img").title;
        var imageSrc = $(this).find("img").src;

        // But these both print "undefined"...
        alert(imageTitle);
        alert(imageSrc);
    }
}

How do I get the <img>‘s title and src attributes? As indicated in the code above, the current code returns them as undefined. Thanks in advance!

  • 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-03T01:43:47+00:00Added an answer on June 3, 2026 at 1:43 am

    Use .attr()

    Refer: http://api.jquery.com/attr/

    Working Code:

    $("#showDropZone").find("ul").each(function() {
    
    alert($(this).html());
        $(this).find("li").each(function() {
            var detailTitle = $(this).find("p.detailTitle").text();
    
            // This prints "Logo!" correctly...
            alert(detailTitle);
    
            var imageTitle = $(this).find("img").attr('title');
            var imageSrc = $(this).find("img").attr('src');
    
            // But these both print "undefined"...
            alert(imageTitle);
            alert(imageSrc);
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following HTML: <div class=olympics style=display: block; position: absolute; left: 250px; top: px;>
I have the following HTML: <div style=position: relative; text-align: left;> <img id=chart_6c544b37_ac9d_49ed_912e_5ff8ad6c0181_BaseImage src=chart.gif width=460px
I have the following HTML: <div class="selfClear" style="float: left; border: 1px solid black;"> ...floated
I have following HTML <div id=finalTree> <ul> <li class=last style=display: list-item;> <a id=DataSheets href=#>Data
i have following html structure. <p class=expandableContent ><span class=label>Computer and Laptop Repairs</span></p> <div style=clear:
I have the following HTML: <div style=float:left; background-color:#0CC;>Floating Left</div> <div style=background-color:#03C; color:#FFF;>Not floating</div> Which
I have the following html : <div class=mainmenu> <ul class=blue> <li class=><a href=tst/ id=a1_up><span
I have the following HTML <div class=myclass value=1> <div> <div class=myclass value=> <a class=popup
I have the following html <div class=someClass> Some text </div> <div class=someClass> Some other
I have the following HTML <div id=testID class=test1> <img id=testID2 class=test2 alt= src=some-image.gif />

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.