RSS Feed
Apr 26

Select all friends in Facebook Questions

Posted on Tuesday, April 26, 2011 in Experiments

Of late I have been spending a lot of time in Facebook. I believe Facebook has become an integral part of internet users. I spend more time in Facebook than my Gmail. Facebook has become the hottest medium for SME to market and sell their products. It is easily the best cost effective medium through which you can engage with your users.

I use Facebook predominantly for my Society activities. Society uses Facebook to market their events and engage with the community. I use Questions feature in Facebook a lot. Questions will enable you to understand the pulse of your users. So as I was using this feature I found it very difficult to ask the question to my friends. I had to click each friend manually and it was tiring job.

Since it was plain HTML I felt that there should be a easy way to do this job. I googled and found a Javascript which works like a dream. So here is the Javascript

javascript:(function(){var f=document.getElementsByClassName("fbProfileBrowserListContainer");for(var i=0;i<f.length;i++){if(f[i].children){var c=f[i].getElementsByTagName("input");for(var l=0;l<c.length;l++){c[l].click();}}}})();

The Javascript code will get the children of the div with class “fbProfileBrowserListContainer” as shown below. The script will them loop through all the Input tags and generate a click event.

Facebook questions - Div of class fbProfileBrowserListContainer

One of the reason why I love HTML ahead of Flash is that HTML is native to the browser. HTML / JS / CSS allows you to play around with the content and its fun.

Note: You have scroll through full list of your friends first before executing the Javascript.