Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Twitter data-url and a jquery generated list

Hello Everyone,

I need a bit of help on this one. I am using this bit of jquery (https://github.com/sdepold/jquery-rss) to generate an rss list. Works great - no problems; however, I would like to place a "tweet button" next to each generated list item (each item in the rss). I want that tweet button to pull the url of the jquery generated link into the tweet message. Twitter (https://dev.twitter.com/docs/tweet-button) has a function build into their tweet button (data-url) that will allow you to specify a specific link (instead of the default page link); however, how can I tell the data-url that the link I want is X url that is generated list? Because this is an rss feed, the links are constantly changing.

In other words, I will use the jquery-rss code to create an unordered list of latest four posts on a blog. EACH list item contains a javascript created title, url, and a snippet of the post body. How can I get the url out of that jquery generated list item and pull it into twitter's data-url class? Any ideas? For the code, simply use the example code provided by github and twitter developers page.

Thanks

1 Answer

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

Hi Joe,

It maybe an idea to share where you're at so people can see what you're trying to do. Show what you've tried to do to solve your problem. Then people don't waste time trying what you've done already.

Regards Andrew