Showing the name of preferred services

willembuys May 08, 2012 05:22AM EDT

Currently I specify each service I want to show on my site, manually including its name in the anchor text.

E.g. <a class="addthis_button_facebook">Facebook</a>

This works fine.

I would like to switch to the preferred services. However, when I use

<a class="addthis_button_preferred_1"></a>

only a button shows up. The name of the service is not included.

So I tried to include it by using the following code:

<div id="at-toolbox" class="addthis_toolbox addthis_default_style"></div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pub=x">
<script type="text/javascript">
addthis.user.getPreferredServices(function(services){
var el = document.createElement('div');
document.body.appendChild(el);

if (services.length) {
// Loop over personalization entries
for (var i=0; i < 4; i++) {
var service = services[i],
tbx = document.getElementById("at-toolbox");

tbx.innerHTML += '<a
class="addthis_button_'+service+'">'+service+'</a>';

}
tbx.innerHTML += '<a class="addthis_button_more">Meer...</a>';
addthis.toolbox("#at-toolbox");
}
});
</script>

This renders the service name unformatted. Is the formatted name available? How can I get it?

Thanks for your help.

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)

Still need help?


General Topics

 

Developers