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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:02:14+00:00 2026-05-27T00:02:14+00:00

How to fetch image icons from an Array & append one by one inside

  • 0

How to fetch image icons from an Array & append one by one inside DIVs. I have an array with image path. I want to fetch images from that array & append one by one inside DIVs.

I want to append those icons in “class=acc_trigger” divs.. here is the HTML

<div class="container">

    <h2 class="acc_trigger"><a href="#">Home</a></h2>
    <div class="acc_container">
        <div class="block">
            <ul>
                <li><a href="#">One</a></li>
                <li><a href="#">One</a></li>
                <li><a href="#">One</a></li>
            </ul>

        </div>
    </div>

    <h2 class="acc_trigger"><a href="#">Req Mgmt</a></h2>
    <div class="acc_container">
        <div class="block">
                <ul>
                <li><a href="#">Requirments</a></li>
                <li><a href="#">Use Cases</a></li>
                <li><a href="#">Test Cases</a></li>
            </ul>         
        </div>
    </div>

    <h2 class="acc_trigger"><a href="#">Test</a></h2>
    <div class="acc_container">
      <div class="block">
            <ul>
                <li><a href="#">One</a></li>
                <li><a href="#">One</a></li>
                <li><a href="#">One</a></li>
            </ul>
        </div>
    </div>

    <h2 class="acc_trigger"><a href="#">Project</a></h2>
    <div class="acc_container">
        <div class="block">
            <ul>
                <li><a href="#">One</a></li>
                <li><a href="#">One</a></li>
                <li><a href="#">One</a></li>
            </ul>
        </div>
    </div>

</div>

*********** JQUERY ARRAY *****************


 var $iconLeft = new Array();
                $iconLeft[0] = 'images/icons/home_icon.gif';
                $iconLeft[1] = 'images/icons/reqMgmt_icon.gif';
                $iconLeft[2] = 'images/icons/test_icon.gif';
                $iconLeft[3] = 'images/icons/project_icon.gif';
                $iconLeft[4] = 'images/icons/issue_icon.gif';
                $iconLeft[5] = 'images/icons/more_icon.gif';

Should I use .each() ?? if so, how to use that? please help.

  • 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-27T00:02:15+00:00Added an answer on May 27, 2026 at 12:02 am

    Try this out:

    $(document).ready(function () {  
    $('h2.acc_trigger').each(function(i){
      var icon = new Array;
      icon[0] = 'images/icons/home_icon.gif';
      icon[1] = 'images/icons/reqMgmt_icon.gif';
      icon[2] = 'images/icons/test_icon.gif';
      icon[3] = 'images/icons/project_icon.gif';
      icon[4] = 'images/icons/issue_icon.gif';
      icon[5] = 'images/icons/more_icon.gif';
    
      $(this).prepend('<img src='+icon[i]+' />');
      });                
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to fetch some HTML from various blogs and have noticed that different
Hail! I want to fetch image from NOT PUBLIC Google Site's page. I'm using
I have a PHP script that fetches an image from a remote server so
I've got an image gallery that is showing one image per row inside of
Good day, I have a question here. I am trying to fetch image from
How can I fetch images from a server? I've got this bit of code
I fetch a JSON array from a web service with touchJSON. Which looks like
I want to fetch the unmatching records from two table in SQL, the table
What is the simplest way to fetch an image from a url in an
I'm using PHP GD to fetch an image from a remote server. $res=imagecreatefromJPEG ($url);

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.