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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:46:38+00:00 2026-06-04T12:46:38+00:00

After ul tag i want to call function in javascript to add list item

  • 0

After ul tag i want to call function in javascript to add list item dynamically
and inside i want to place image tag as shown below.

<li> <img src="images/testpic" height="200px" width="200px" /> </li> 

i have used .append() method in jquery but doesn’t work

<script type="text/javascript">
                '$('ul').append("<li><img src='thumbs/image"+i+".jpg' width='175' height='175' /></li>");
                '$('ul').append("<li><img src='thumbs/image"+i+".jpg' width='175' height='175' /></li>");
                '$('ul').append("<li><img src='thumbs/image"+i+".jpg' width='175' height='175' /></li>");

  • 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-04T12:46:40+00:00Added an answer on June 4, 2026 at 12:46 pm

    From a for loop

    for ( var i = 0; i < 10; i++ ) {
        $("<li>",{ html:'<img src="http://placekitten.com/100/100?image='+i+'" />' })
            .appendTo("#images");   
    }​
    

    From an Array of Images

    If all you’re wanting to do is add list items with images inside:

    // You have a mention of i in your example, so I assume you are
    // cycling over some sort of list - so I'll do the same
    ​var images = [ 'http://placekitten.com/50/50', 
                   'http://placekitten.com/50/50?image=2' ];
    
    // You had some malformed markup in your code, the following keeps it simple
    ​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​$.each( images, function( i, v ) {
        $("<li>", { html: '<img src="' + v + '" />' }).appendTo("#images");        
    });​
    

    Fiddle: http://jsfiddle.net/YwH7Z/

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

Sidebar

Related Questions

I just want to know how to define HTML Tag <br clear=all> after each
in a method, i want to call a method after n seconds: self.toolBarState =
I want to move a node and call a block after move done. But
I am wondering how can I hide/remove a tag after a certain amount of
After reading http://www.w3schools.com/tags/tag_noscript.asp confused about onclick event on noscript tag. Anybody knows the purpose?
I'm building a tagger. After a user submits a tag, ajax returns: {returnmessage:The Ajax
Just like stackoverflow, there is a many-to-many relationship between Question and Tag. After running
After creating roles and granting privileges to them, I want to grant the privileges
i am trying to call a function that is defined in a class RFIDeas_Wrapper
I want an HTML form to do nothing after it has been submitted. action=""

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.