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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:26:07+00:00 2026-05-23T20:26:07+00:00

I am trying to retrieve data from an img element inside a html web

  • 0

I am trying to retrieve data from an img element inside a html web page using jQuery.

I know from the start that there is only 1 image but when I run the following code, I get 2 alert boxes.
They contain the same information..

Does anyone know what i am doing wrong?

$("#tableX td").find("img").each(function() {
    if ($(this).data("apple") == "orange") {
        alert($(this).attr("src"));                
    }
});

Thanks.

UPDATE:

DOM output..

<td id="tdP4" align="center" style="border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px; border-left-width: 2px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(201, 201, 201); border-right-color: rgb(201, 201, 201); border-bottom-color: rgb(201, 201, 201); border-left-color: rgb(201, 201, 201); "><img id="imgP4" src="/images/t/00.jpg" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; width: 63px; height: 103px; display: block; background-color: rgb(71, 7, 79); " alt="00"></td>
  • 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-23T20:26:08+00:00Added an answer on May 23, 2026 at 8:26 pm

    There are two possible reasons:

    • Either you have several rows containing an image (the selector selects all images in the whole table)
    • or the code is run twice.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to retrieve data from an SQL Server 2000 server, and place into
I'm trying to retrieve a file from a server using SFTP (as opposed to
I am trying retrieve data from a .php file on a server from within
Iam trying to retrieve data from mysql database into stylesheet.php but it is not
Hi i am trying to retrieve data from mysql database to create flot graph
I'm trying to retrieve an XML stream from a URL. For most URLs my
I am trying to retrieve the attribute name and type that exist in an
Basically I am trying to retrieve a list of stored procedure parameters using Linq
I am trying to use ResourceBundle#getStringArray to retrieve a String[] from a properties file.
I am trying to retrieve a user on Sharepoint's user photo through the WSS

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.