Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 3  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Does jQuery have a collect method
  2. var selected = new Array();
  3.         $(".client_associates_users input:checked").each(function(index) {
  4.             selected.push($(this).val());
  5.         });
  6.        
  7. var selected = $(".client_associates_users input:checked").map(function(index) {
  8.     return this.value;
  9. }).get();
  10.        
  11. var $checkboxes = $(".client_associates_users input:checked"),
  12.     selected = $checkboxes.map(function(i){
  13.         return $checkboxes.eq(i).val();
  14.     }).get();
  15.        
  16. var $checkboxes = $(".client_associates_users input:checked"),
  17.     selected = $.map($checkboxes, function(el,i){
  18.         return $checkboxes.eq(i).val();
  19.     });