var checked = $("input[type=checkbox]:checked").length; if (checked >= 1) { // do something }
On May 26, 11:27 am, macsig <sigbac...@gmail.com> wrote: > Hello all, > I have a form with some checkboxes and I would like to submit it > (through jquery) only if at least 1 checkbox is checked, otherwise I > want to display an alert message. > > How can I get the number of checked boxes? > > I tried $("INPUT[type='checkbox']").is(':checked') but looks > like it doesn't work. > > Any ideas about how I can achieve so? > > Thanks and have a nice day! > > Sig