Jquery / JS problem with adding clicks for object in list

I don’t have a working example of this, so I’m sorry I can’t redirect you to a url. I think this is a fairly easy to solve issue… at least I hope.

I’m trying to change/update something someone else did.

ABC.StoryTools.ShareThis.prototype.render = function() {
var self = this;
var ul = $(’#shareListOverlay’).find(‘ul’).empty();
var href, li, item;
var title = document.title.replace(/ - ABC company$/, ‘’);
var list = ABC.storyTools.shareList;

var section = siteMapTerm ? siteMapTerm.replace('Sections.','') : ""; 
var relatedAccts = self.getTwitterList(section);
var summary = ABC.storyTools.storySummary ? ABC.storyTools.storySummary.substring(0 , 255) : "";
var originalUrl = document.URL;
var canonicalUrl = $('link[rel=canonical]').attr('href');
if(!canonicalUrl){
    canonicalUrl = originalUrl;
}




for(var i=0; i<list.length; i++) {
item = list*;

href = item.link.replace('{url}', escape(canonicalUrl)).replace('{title}', encodeURIComponent(title))
        .replace('{section}', encodeURIComponent(section))
        .replace('{summary}', summary)
        .replace('{source}', 'Financial Times')
        .replace('{canonicalurl}', escape(canonicalUrl))
        .replace('{originalUrl}', escape(originalUrl))
        .replace('{relatedAccts}', encodeURIComponent(relatedAccts));
    
li = $('<li/>').addClass(item.id);

    if(item.css) {
        li.attr('style', item.css);
    }


    $('<a/>').text(item.label).attr('href', function(){
newwindow=window.open(href, '', 'height=400,width=500');}).attr('si:link', 'social-media_' + item.id).appendTo(li);
    
    
    li.appendTo(ul);
    
}    

};

I click a “share this” button and it launches an overlay with a bunch of buttons from ‘list.’ What’s happening is that after clicking the “share this” button, it launches a popup for each button in the list. I want to launch a popup only when you click a button from the list.

Ideas?