Multiple facebook friend selector for facebook app 1

I was searching for methods to select multiple friends for facebook and came to know a javascript plugin made by keeganstreet. Using this plugin for your facebook app is very simple. Download source code and add your app id in example.js to test.

Download Source            Live Demo

multiple friend selector interface

Including  tdfriendselector.js  is necessary and if you want to use default interface include the tdfriendselector.css stylesheet in your document. Use whole TDFriendSelector div from index.html as it is if you want to use default interface.

First of all, you have to initialize the plugin.

TDFriendSelector.init({debug: true});

Following code will create friend selector instance. You can create multiple instances per page.

selector = TDFriendSelector.newInstance({
 callbackFriendSelected : callbackFriendSelected,
 callbackFriendUnselected : callbackFriendUnselected,
 callbackMaxSelection : callbackMaxSelection,
 callbackSubmit : callbackSubmit,
 maxSelection : 1,
 friendsPerPage : 5,
 autoDeselection : true

To bind a button with selector to show interface, use following code.

$("#btnSelect").click(function (e) {

Following code will print selected friends. logActivity is the function to print output .

callbackFriendSelected = function(friendId) {
 var friend, name;
 friend = TDFriendSelector.getFriendById(friendId);
 name =;
 logActivity('Selected ' + name + ' (ID: ' + friendId + ')');

The friends are returned as an array of Facebook IDs.

  • Shadab Jaffri

    >_< dnt knw how to make it work :/

Join The Geek Side

Recommend on Google