Created
January 20, 2011 23:40
-
-
Save kristjan/788952 to your computer and use it in GitHub Desktop.
Count the number of friends you've selected in a FB inviter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateTotalSelected(form) { | |
var totalSelected = getTotalSelected(form); | |
var elem = getElementsByClassName(form, 'current_selected', 'span')[0]; | |
elem.setTextValue(totalSelected) | |
} | |
function getTotalSelected(form) { | |
var serializedForm = form.serialize(); | |
var ids = serializedForm.ids; | |
if (!ids) { | |
return 0; | |
} | |
var totalSelected = 0; | |
for (var i in ids) { | |
totalSelected++; | |
} | |
return totalSelected; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fb:request-form type="cause" invite="true" | |
onclick="updateTotalSelected(this)" ...> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment