Created
August 6, 2014 14:23
-
-
Save badcrocodile/24d338b1d81c9efbf934 to your computer and use it in GitHub Desktop.
map a group of checkboxes into an array in three lines of jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find all of the checked boxes in the container and map them into an array | |
var searchIDs = $checkboxContainer.find('input:checkbox:checked').map(function() { | |
return $(this).val(); | |
}).get(); | |
// searchIDs is now an array containing the values of the checked boxes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment