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

  • Home
  • SEARCH
  • 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 3314862
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:16:58+00:00 2026-05-17T22:16:58+00:00

This worked great when there was only one entry in the database, but add

  • 0

This worked great when there was only one entry in the database, but add another and now I’ve got problems. Since I’m appending based on class names I’m getting every element appending to a single class. I don’t know what to do in order to create two “blogHeadlines” with the appropriate content in each.

jquery:

        $(blogEntries).each(function () {
            //Create the blog headline element         
            $('#blogPage').append($('<div class="blogHeadline">'));

            //Add the toggle button
            $('.blogHeadline').append('<input class="toggleButton" type="button" value="+" />');

            //Append the title and the date to the blogHeadline
            $('.blogHeadline').append('<span class="blogTitle">' + this.Title + ' | </span>');
            //Cast the date to a Date object
            var BlogDate = new Date(this.Date);
            $('.blogHeadline').append('<span class="blogDate">' + BlogDate.toDateString() + '</span>');

            //Add the blog content element
            $('#blogPage').append($('<div class="blogContent">'));
            //Append the blog entry
            $('.blogContent').append(this.Entry);

            //Toggle the blog content
            $('.toggleButton').live("click", function () {
                $('.blogContent').slideToggle('slow');
                $('.toggleButton').val() == "+" ? $('.toggleButton').val('-') : $('.toggleButton').val('+')
            });
        });

The output of course is ridiculous, It looks kind of like this:

The second test | Wed Oct 27 2010test blog | Mon Sep 20 2010This is the second blog entry from Joe Grigg

This is a test blog

test blog | Mon Sep 20 2010

This is a test blog

It should be more like:

The second test | Wed Oct 27 2010

This is the second blog entry from Joe Grigg

test blog | Mon Sep 20 2010

This is a test blog.

Thanks for helping.
-Joe

  • 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-17T22:16:58+00:00Added an answer on May 17, 2026 at 10:16 pm

    avoid to append to content you just created:

    $(blogEntries).each(function () {
       //Create the blog headline element   
    
       var BlogDate = new Date(this.Date);
    
       var Headline = $('<div class="blogHeadline" />');
    
       Headline.append('<input class="toggleButton" type="button" value="+" />')
               .append('<span class="blogTitle">' + this.Title + ' | </span>')
               .append('<span class="blogDate">' + BlogDate.toDateString() + '</span>')
               .appendTo('#blogPage');
    
       // now do something similar with your Content:
       //...
    });
    

    And $(‘.toggleButton’).live() does not need to be defined on every iteration.

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

Sidebar

Related Questions

I changed the folder that my WordPress installation was in. However, this worked fine,
Something like this might had worked <%= Html.RouteLink(, new { controller = Article, action
I recently asked this question and worked out that the reason a single email
I worked on an embedded system this summer written in straight C. It was
This is a subjective question. I worked in Visual Basic 6.0 before coming into
I have never worked with web services and rails, and obviously this is something
This is a bit of a long shot, but if anyone can figure it
One of the best features of gwt is the edit/save/refresh development cycle. This has
I really like the IIS7 URL rewriting module and so far, it worked great
Within Authlogic, is there a way that I can add conditions to the authentication

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.