Hi, > And try something like: > > var toto = []; > $('.toto').each(function(){ > var elem = $(this); > toto[elem.attr('ref')] = elem; > } > > Then, to hide the "toto" div with ref="1" or ref="2", just call: > > toto[1].hide(); toto[2].hide();
Why not use this: var toto = $('.toto'); toto[1].hide(); toto[2].hide(); That should be the same. Appart from that I think, that Jean Babtiste wanted to hide all elements at the same time. I'd expect his first ( $('.toto').hide() ) version to be usually faster, but I'm not shure about that. Christof