title: Javascript function works only on one variable
body: <p>I'm working on a plugin, however it works for one half now. The problem is that I get a few variables from a checkbox, but the function will only work on the last checked item (in the list) of the checkbox, not for the others.</p>
  
  <p>My code:</p>
  
  <pre><code>jQuery(document).ready(function(){
  
    jQuery('#gap-filtedit input[type=button]').click(function(){
      jQuery('.filter-checkbox:checked').each(function() {
        getchecked = jQuery(this).data('rel');
  
        val = '[gap ';
        console.log(getchecked);
  
        jQuery('.' + getchecked).each(function(){
          val = val + getchecked + '=';
          name = jQuery(this).find('label').data('id');
          title = jQuery(this).find('input[type=text],select').val();
  
          if (!title) title = '';
          if (name != 'null') {
  
            val = val + name + ':' + title + ', ';
  
          }
        });
      });
  
  
      window.send_to_editor( val );
    });
  });
  </code></pre>
  
  <p>The log will give me the selected options. However the function after the <code>console.log</code> will only work on the last selected in the row.</p>
  
  <p>How to get the function to work for every selected item?</p>