i’m using jgfeed to retrive a feed with jquery. It works well.
It shows all the titles and the links.
This is the code:
$.jGFeed('http://www.link.org/feed',
function(feeds){
if(!feeds){
alert('No network');
}
for(var i=0;i<feeds.entries.length;i++){
var entry = feeds.entries[i];
var title = entry.title;
var link = entry.link;
var html = "<ul class='pageitem'><li class='textbox'><span class='header'>" + title + "</span></li><li class='menu'><a href='" + link + "'><span class='name'>Read more</span><span class='arrow'></span></a></li></ul>";
$("#feedContent").append($(html));
}
}, 20);
And in the html:
<div id="feedContent"></div>
But i need to do a window.open of every link instead the href. I tested a lot of things but I can’t do it …
Any help?
Since you’re using jQuery, you could setup your own event handler for links in the list.
Note that we’re using
$.delegate()rather than$.click(). This is because the<a>tags we’re handling don’t exist on page load. Usingdelegate()ensures that all future<a>tags in the list get the event handler.