Derk Arts Derk Arts -4 years ago 232
Javascript Question

How to invite all friends on Facebook for an event

I wanted to invite all my friends to an event on Facebook. This is quite cumbersome so I wrote a little script you can execute from the console (using Firefox or Chrome).

Works as of November 2012.

I post it here so others might find it.

Answer Source

Execute this from the console (using Firefox or Chrome) when the Invite window is open (with all the checkboxes for your friends). Make sure to scroll down all the way first.

UPDATED ANSWER to reflect latest changes. Works as of 22-05-2017

To invite to events:

elms=document.getElementsByClassName('_1pt_ _1pu0');
for (i=0;i<elms.length;i++){if (elms[i].type="checkbox" )elms[i].click()}

To invite to pages:

var inputs = document.getElementsByClassName('uiButton _1sm'); 
for(var i=0; i<inputs.length;i++) { inputs[i].click(); } 

Be aware that Facebook now disables the console to prevent an ongoing scam, you can enable it here:

But please, when you do, only execute javascript in the console that you can really trust!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download