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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:02:21+00:00 2026-06-01T08:02:21+00:00

I have populated an array with a few html image tags that I have

  • 0

I have populated an array with a few html image tags that I have created. I’m trying to get the contents of that array to appear as the actual images on the page with the following code:

 $(document).ready(function(){        //populates array with images
        var shipImgs = $("#thumb_slider").children().each(function(index, element) {
            var newImg = $("<img />").attr({src: this.src, alt: 'space'}).addClass(index == 0 ? "middle_slot" : (index == 1 ? "left_slot" : "right_slot"));
            imgArr.push(newImg);
        });

and then after a button on the page is clicked, it calls a function which should display the images in a div called basic_div with the following line of code:

$("#basic_div").html(imgArr[b] + imgArr[a] + imgArr[c]);

Instead of seeing the images, all you get is [object Object] when the array is displayed. What is the correct way to “translate” this from a jquery object to actual html code to display the images? If you need to see it in action you can find it here: http://www.digitalbrent.com/lab and then press the increase button. Thanks!

  • 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-01T08:02:25+00:00Added an answer on June 1, 2026 at 8:02 am

    The .html function takes a string. You are passing it objects (or at least you are passing it the dubious ‘summation’ of objects). So you need to either build your array with literal strings for the img tags (and attributes), or do something like the following:

    var newImg = $("<img>");
    newImg.attr('src', "tiffany-joy-10.jpg");
    newImg.appendTo('#mydiv')
    

    I tested it and it works (and she looked good :).

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

Sidebar

Related Questions

I have a PHP file that serves up a JSON array populated from a
Hi guys i have an array that is populated with dates Array ( [0]
I have an associative array in awk that gets populated like this: chr_count[$3]++ When
I have my array populated like so: updateLabels: function () { var diagrams =
I have a nested php array. I have the first select populated already. I
In a controller, I have populated a map that has a string as key
I have table view which is populated from an array grabbed from a url.
I have few arrays of ccspirit images, these are balloons of different colors, like
I have an array populated by dictionaries, and I need to sort the array
I have populated an html form with MySQL data from a table. I have

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.