0

In a loop I have some checkboxs that I set a class name :

class="ids[]"

Because my loop is inside a form,at first time I want to find out any checkbox is check or not.

var ids = new Array();

$('.ids[]').each(function(index, element) { 
    if(this.checked) {
        ids.push($(this).val());
    }
});

if(ids.length == 0 ) {
    alert('not checked any checkbox');
    return false;
}

$('.ids[]').each... not fetch anything.

Ibrahim Khan
  • 20,616
  • 7
  • 42
  • 55
S.M_Emamian
  • 17,005
  • 37
  • 135
  • 254

0 Answers0