title: jQuery Plugin Remove Element From Each Loop
body: <p>I want to remove and element from an each() loop inside a plugin so I will only return some specific itens. But so far I made many tests and I still cannot remove the item.</p>
  
  <pre><code>(function($){
  
  $.fn.teste = function(parametro){
  
      var parametro_padrao = {};
      if (parametro){$.extend(parametro_padrao, parametro);}
  
      return this.each(function(){
  
          //if certain condition happens I want to remove an element  so it will not be returned in the "return" clause above
  
      });
  
  
  };
  
  })(jQuery);
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>the :hidden or :visible are not good cause they use offset which I believe is a bad idea.</p>
  
  <p>After some time I found a great solution and I will share so others will not lose time as me:</p>
  
  <pre><code>(function($){
  
  $.fn.visivel = function(parametro){
  
      var parametro_padrao = {};
      if (parametro){$.extend(parametro_padrao, parametro);}
  
      elemento = this;
      this.each(
  
          function(index){
  
              $(this).parents().andSelf().each(
  
                  function() {
  
                      if (   ($(this).css("display") == "none")   ||   ($(this).css("visibility") == "hidden")   ) {
  
                          delete elemento[index];
                          return false;
  
                      }
  
                  }
  
              );      
  
          }
  
      );
  
      return elemento;
  
  };
  
  })(jQuery);
  </code></pre>