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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:59:08+00:00 2026-06-04T00:59:08+00:00

I have many image elements and want to get a specific image’s source where

  • 0

I have many image elements and want to get a specific image’s source where the alternative text is “example”.

I tried this:

var src = $('.conversation_img').attr('src');

but I can’t get the one I need with that.

How do I select a specific image element based on its alternative text?

  • 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-04T00:59:09+00:00Added an answer on June 4, 2026 at 12:59 am

    To select and element where you know only the attribute value you can use the below jQuery script

    var src = $('.conversation_img[alt="example"]').attr('src');
    

    Please refer the jQuery Documentation for attribute equals selectors

    Please also refer to the example in Demo

    Following is the code incase you are not able to access the demo..

    HTML

    <div>
        <img alt="example" src="\images\show.jpg" />
        <img  alt="exampleAll" src="\images\showAll.jpg" />  
    
    </div>
    

    SCRIPT JQUERY

    var src = $('img[alt="example"]').attr('src');
    alert("source of image with alternate text = example - " + src);
    
    
    var srcAll = $('img[alt="exampleAll"]').attr('src');
    alert("source of image with alternate text = exampleAll - " + srcAll );
    

    Output will be

    Two Alert messages each having values

    1. source of image with alternate text = example – \images\show.jpg
    2. source of image with alternate text = exampleAll –
      \images\showAll.jpg
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have many div's with the same background image and i want change this
Many mobile web browsers have some default functionality on image hold. For example, user
I want to grab all elements on a page that have a css background-image.
How can I set an image for UITableViewController ? I have used many things
I have a product, and a product can have many images. This is through
So the problem is when you have a block of text, and an image
I have one activity with many elements on it, when is first started it
I have an html file which contains many elements: <div> <div id=imgElt11289447233738dIi15v style=BORDER-RIGHT: 0px;
I have this code, $(function () { $.post(fetch_data.php?url=+$('#url').val(), { }, function(response){ var arrValues =
  I understand that elements can have multiple classes: .rfrsh-btn { background-image:url(../../upload/rfrsh_nb_grey.png); ... }

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.