If all these checkboxes are in the same container where no other
checkboxes are you can use somthing like this
$('#id input:checkbox:checked').length

Or if there are other checkboxes in the way you can give all these
checkboxes the same class name and do
$('#id input.classname:checkbox:checked').length

Think these should both work, if I've understood what you are asking
for.

On Oct 18, 8:41 pm, choffman <[EMAIL PROTECTED]> wrote:
> Hello,
> I have a form where the values are pulled from MySQL and looped
> through using PHP. The name and id values are create dynamically.
>
> For example HTML:
> Item A <input type="checkbox" name="event_id_22" id="eid_22" / >
> Item B <input type="checkbox" name="event_id_23" id="eid_23" / >
>
> For example PHP:
> Item A <input type="checkbox" name="event_id_$value" id="eid_$value" /
>
> Item B <input type="checkbox" name="event_id_$value" id="eid_$value" /
>
>
>
> I'm using jQuery to count the boxes that get checked.  How can I get
> jQuery to see my PHP variable so it can count the number of boxes that
> get checked?  Thoughts?
>
> $(document).ready(function() {
>         $("#eid_??").click(function() {
>                         if (this.checked == true) {
>                                 var event_id = $("#eid_??").length;
>                                 $("#eventItems").text(event_id);
>                         }
>
>                         if (this.checked == false) {
>                                 $("#eventItems").empty();
>                         }
>         });
>
> });

Reply via email to