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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:35:43+00:00 2026-06-05T14:35:43+00:00

each div has one image having fixed class. i need to change all images

  • 0

each div has one image having fixed class. i need to change all images src inside those div which has class called “.diagnostic_picture” using jquery and also add one new attribute to all the images called “delaySrc” inside that div having class called “.diagnostic_picture”. here this way wrote the code but did not work….can anyone help me. thanks

<div class="diagnostic_picture"><img src="test1.gif" /></div>
<div class="diagnostic_picture"><img src="test2.gif" /></div>
<div class="diagnostic_picture"><img src="test3.gif" /></div>

 $(document).ready(function () {
        $(".diagnostic_picture").each(function () {
            $(this).children("img")
            .attr("src", 'images/ajax-loader.gif')       // this way i change the src
            .attr('delaySrc', $this.attr("src")); ;      // this way i add new attribute
        });
    });

the attribute called delaySrc not being added to img tag inside the div so i change the code bit but still new attribute not being added….i check source by firebug.

change code

  $(".diagnostic_picture img").each(function () {
        var img = $(this);
        img.attr("delaySrc", function () { img.attr("src") })
        img.attr("src", 'images/ajax-loader.gif');
    });
  • 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-05T14:35:45+00:00Added an answer on June 5, 2026 at 2:35 pm

    This is the correct version of your code (note both the changes in html makrup – class values do not need prefix dot, and in javascipt)

    <div class="diagnostic_picture"><img src="test1.gif" ></div>
    <div class="diagnostic_picture"><img src="test2.gif" ></div>
    <div class="diagnostic_picture"><img src="test3.gif" ></div>
    
     $(document).ready(function () {
            $(".diagnostic_picture img").attr("src", 'images/ajax-loader.gif').attr('delaySrc', function() { $(this).attr("src") });
         });
     });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of div with each div having a image inside. The
I have many div.image , each one has a huge size. How do I
I have 8 divs. Each div has the class 'pre-loader'. In addition to thas
a div has few image and the code below is showing one image at
The page has a container div which holds multiple content divs. Each content div
I have a foreach loop in jQuery going through each 'div.panel', I need to
I am trying to insert a <br clear=all /> after each fifth div. Below
I've got a set of items. Each item has two images and some text.
Basically, what I'm trying to create is a page of div tags, each has
I have a dynamic table with each row having 4 columns. Column 1 has

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.