You could do it in a loop using each():

$("input[name^='day']").each(function() {
  if ($(this).is(":checked")) {
     // do whatever
  }
});

On Aug 19, 5:20 pm, blcArmadillo <blackarmadi...@gmail.com> wrote:
> I have a simple set of checkboxes:
>
> <input name="day1" type="checkbox" value="sun" /> Sun <input
> name="day2" type="checkbox" value="mon" /> Mon <input name="day3"
> type="checkbox" value="tue" /> Tue <input name="day4" type="checkbox"
> value="wed" /> Wed <input name="day5" type="checkbox" value="thu" />
> Thu <input name="day6" type="checkbox" value="fri" /> Fri <input
> name="day7" type="checkbox" value="sat" /> Sat
>
> When the state of one of them changes I want to check the state of all
> of them. So far I have:
> $(document).ready(function() {
>         $("input[name^='day']").change(function () {
>
>         });
>
> });
>
> My question is how do I get the value of each of the check boxes? It
> seems like all the commands I see in the jQuery documentation only
> give you the value of the first matched element? Do I have to use some
> sort of for loop? Thanks for the help.

Reply via email to