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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:02:56+00:00 2026-06-12T05:02:56+00:00

I have a list of dynamically generated divs all with unique data-id’s and several

  • 0

I have a list of dynamically generated divs all with unique data-id’s and several image icons contained within. When an Icon is clicked a box pops up allowing a selection dependent on the action chosen. This updates the database via ajax.

I need the first icon to change when the ajax reauest returns 3.

var ls="<div class='list_body'>
            <div class='lister1'>
                <img src='"+path+stat1+"' data-icon_no='1' data-status='"+split_stats[0]+"' data-job_id='"+split_stats[18]+"' />
                <img src='"+path+stat2+"' data-icon_no='2' data-status='"+split_stats[1]+"' data-job_id='"+split_stats[18]+"' />
                <img src='"+path+stat3+"' data-icon_no='3' data-status='"+split_stats[2]+"' data-job_id='"+split_stats[18]+"' />
                <img src='"+path+stat4+"' data-icon_no='4' data-status='"+split_stats[3]+"' data-job_id='"+split_stats[18]+"' />
                <img src='"+path+stat5+"' data-icon_no='5' data-status='"+split_stats[4]+"' data-job_id='"+split_stats[18]+"' />
                <img src='"+path+stat6+"' data-icon_no='6' data-status='"+split_stats[5]+"' data-job_id='"+split_stats[18]+"' />
            </div>
            <div class='lister'>"+split_stats[6]+" "+split_stats[7]+" "+split_stats[8]+"<br />["+split_stats[13]+"]"+"</div>
            <div class='lister'>"+split_stats[14]+"</div>
            <div class='lister'><a href='javascript:void(0);' class='lister_a'>View Appointment &amp; Actions</a></div>
        </div>";

(I have tried to space the code to make it more readable but basically this is just one line of many that is appended to the document)

My jQuery so far is…

$(document).on('click', '.submit_acc', function(){
        var selected=$('.conf_app').val();
        var agent=$('body').data('agent_id');

        if(selected==0)
        {
            alert("Please make a selection from the available options.");
            return;
        }

        var reason=$('.ag_com').val();
        var data="agent_id="+agent+"&selected="+selected+"&reason="+reason+"&job_id="+gl_job_id;
        alert(data);
        $.ajax({
            type:"POST",
            url:"admin_includes/conf_job.php",
            data:data,
            context:gl_job_id,
            success:function(html){

                if(html=="3")
                {
 //this is where I can't get it to work......
                    $('.lister1[data-job_id="'+gl_job_id+'"'').find('img').eq(0).src("images/icons/start_green.png");

                }
            }
        })//end ajax

});

I am baiscally having trouble identifying the row where to change the image.

gl_job_id is a global variable that holds the job_id which is used as the identifier in data-job_id (does that make sense ??)..

Currently this is throwing an error on the selector line but obviously the syntax is totally wrong 🙁

  • 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-12T05:02:57+00:00Added an answer on June 12, 2026 at 5:02 am

    Wrong selector here:

    $('.lister1[data-job_id="'+gl_job_id+'"'').find('img').eq(0).src("images/icons/start_green.png");
    

    you trying to select div by data-job_id, also remove one ' and add ]

    Something like this must be:

    $('.lister1 [data-job_id="'+gl_job_id+'"]').attr('src', "images/icons/start_green.png");
    

    this code select div, then find by data-job_id and set src attribute

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

Sidebar

Related Questions

For my palm pre app I have a dynamically generated list (pulling in data
I have a list of divs that are dynamically generated and looks like the
I have a list of dynamically generated divs that represent panels for selecting various
i'm trying to create dynamically generated icon list for tiny mce. I have written
I have a drop down list which is dynamically generated using ajax on page
On my page, I have a dynamically generated list of radio buttons (created with
I have a selection list that is generated dynamically, it lists a number of
I have a listbox whose values are generated dynamically. The list box contains months
I have a dynamically generated list of students. I want the users to capture
I have a ul list that is dynamically generated upon page load via JavaScript.

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.