JavaScript - - By Sam Deering

jQuery get element ids list using jQuery.map()

This is a quick example use of the jQuery .map() function. Say for instance you wanted to get a comma-separated list of all checkbox IDs in a form, you can do this! Check out the quick demo at https://jsfiddle.net/CEcgL/.

$(':checkbox').map(function() {
  return this.id;
}).get().join(',');

Official jQuery.map() Doco

Sponsors