For each element returned by

{! followers }

one checkbox is created. I have a submit button, and 'on Submit' I want to record which checkboxes are and are not checked.

<apex:repeat value="{! followers }" var="follower">
            $('<input>', {type:"checkbox"}).addClass('myCheckBox').attr('id', '{! follower.subscriberId }')
            $('<label>').text('{! follower.Subscriber.Name }')

How would I pass the values from these check boxes to the submit button? I just want to alert() or console.log() them once they reach the submit button.

Something like this maybe?

if ($('.myCheckBox').is(':checked')){

Or this?

if ($('#attendees input').is(':checked')){
    alert($('#attendees input').attr('???'))

Found a solution:

var cbValues = $(".myCheckBox").map(function() {
    return this.checked;

  • mark your solution as "solved" – Scott Pelak Oct 17 '13 at 17:30
  • It takes 2 days before you can mark your own answer as correct. – Daft Jun 11 '14 at 9:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.