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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:24:01+00:00 2026-06-17T16:24:01+00:00

I am using the Google Feed API to pull four items from an RSS

  • 0

I am using the Google Feed API to pull four items from an RSS feed. I want to style the last item on the list (the fourth) differently from the first three. It seems like there must be a simple way–but I can’t seem to figure it out. Here’s what I’ve got:

google.load("feeds", "1");

function initialize() {
    var feed = new google.feeds.Feed("http://the-url-of-my-feed");
    feed.load(function(result) {
        if (!result.error) {
            var container = document.getElementById("joes-teaser");
            for (var i = 0; i < result.feed.entries.length; i++) {
                var entry = result.feed.entries[i];
                var li = document.createElement("li");
                li.innerHTML = '<a href="' + entry.link + '" target="_blank">' 
                    + entry.title + '<span>More &raquo;</span></a>';
                container.appendChild(li);
            }
        }
    });
}
google.setOnLoadCallback(initialize);

That gives me a nice list of four li items, but I want the last, and only the last, to have a css id of something else–maybe joes-teaser-last or whatever.

  • 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-17T16:24:02+00:00Added an answer on June 17, 2026 at 4:24 pm

    In your loop you can check if i is the last one by comparing it to the entries’ length.

    for (var i = 0; i < result.feed.entries.length; i++) {
        var entry = result.feed.entries[i];
    
        var li = document.createElement("li");
        if (i == result.feed.entries.length - 1) {
            li.className = "lastLi";
        }
        li.innerHTML = '<a href="' + entry.link + '" target="_blank">' + entry.title + '<span>More &raquo;</span></a>';
        container.appendChild(li);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Google reader API to get all available items for any RSS feed.
I'm using the Google AJAX Feed API to search for a RSS feed. It
I am using GoogleFeed API ( https://developers.google.com/feed/ ) to retrieve RSS feeds using this
When making a feedreader in Javascript (using google's feed API) I want to use
I am writing a code using Google-Ajax-Feed-API to get latest feeds from some site.
I am using Google feed API to load rss in my website. The Procedure
I am using googles ajax feed api to feed from an RSS. However, i'm
Using the API, trying to get items in a specific feed returns this: {direction:ltr,id:feed/
I get this error when trying to get a feed from Google Analytics API.
I am using the JQuery Google Feed plugin (gFeed) to output an RSS feed.

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.