Register now and start sharing your code snippets.
-->

Getting the state of checkboxes with jQuery

JavaScript posted 9 months ago by christian

The following code will loop through all selected (checked) checkboxes and collect their values in an array:

   1  var selected = [];
   2  $('#select-columns input[@type=checkbox]').filter(':checked').each(function () {
   3  	selected.push(this.value);
   4  });
   5  console.log(selected);

More examples can be found here

Tagged jquery, checkbox