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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:06:21+00:00 2026-05-26T22:06:21+00:00

I want to add some divs using jQuery in a main div called activity-div

  • 0

I want to add some divs using jQuery in a main div called activity-div and then add a list to every div. But list items are not same for every div. So i think i need to give id to every div and then using that id i can access div and put list items in that div. i am using this jQuery code:

 for (i=0;i<obj.length;i++){
     $('#activity-div').append('<div class="area" id="area"'+i+'><h3><a href="#">'+obj[i].name+'</a></h3></div>');

      }

Lets suppose obj.length is 5. Then 5 divs will be added. and their id’s will be area1, area2, area3, area4 and area5. My question is how can i get these divs by id using a loop. I know that a div can be accessed using this:

   ('#area1').append('<ul><li></li></ul>');

i want to access all divs i created using the loop and then add list in that. How can i do that? what will be the syntax for that? I tried

 ('#area'+i).append('<ul><li></li></ul>');

but it didn’t work. I am new to jQuery and couldn’t find any online help. Thanks in advance.

  • 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-26T22:06:22+00:00Added an answer on May 26, 2026 at 10:06 pm

    $('#area'+i).append(); should work!

    You do have an error in your code:

    append('<div class="area" id="area"'+i+'><h3>
    

    should be:

    append('<div class="area" id="area'+i+'"><h3>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi im trying to add some effects to divs on my website using Jquery.
I want to add some jQuery functionality to our sites where one piece of
I want to add some style to head tag in html page using javascript.
I have got a Listbox and i want to add some Items. There are
I want to be able to add some onclick event handlers to some DIV
I have a website built with ASP.NET (3.5) and want add some level of
I want to add some logging capability to a cf.net application running on WM6
I want to add some Ajax -niceness to my Django-coded website. In my Django
I want to add some functionality track certain calls to ActiveX object methods in
I want to add some html in an email. I've tried the following. vFromName

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.