In jQuery, the $.each method has a callback returning an index and a DOM node, and the latter is a native DOM node not wrapped in jQuery, so you need to wrap it to work with jQuery, for example attr() , otherwise you will have to use your own methods such as getAttribute('rel')
var checked_keys=[]; $("input[type='checkbox']:checked").each(function(index, value){ checked_keys.push( $(value).attr('rel') ); });
As a side element, there is also a $.map method that looks more appropriate
var checked_keys = $("input[type='checkbox']:checked").map(function(index, value){ return $(value).attr('rel'); });
source share