Something like ... ?

var uniq_src = []
   , singleton = function(){
      if($.inArray(this.src, uniq_src) < 0){
        uniq_src.push(this.src);
        return true;
      }else{
        return false;
      }
   };
$('img').hide().filter(singleton).show();

... or even ... ?

var uniq_src = [];
$('img').each(function(){
    var showme = ($.inArray(this.src, uniq_src) < 0);
    if(showme) uniq_src.push(this.src);
    $(this)[showme ? 'show' : 'hide']();
 });


On Jun 3, 9:24 am, giannandrea <[EMAIL PROTECTED]> wrote:
> Id like to run though all the elements of a particular class/name on a
> page and unhide only the first of each that have a particular
> attribute.  for example imagine a table with many img tags, and we
> want to show only one of each href.
>
>     var id;
>     var singleton = function() {if((this != id) && (id = this))
> {return true} else {return false}}
>      $("img").hide().filter(singleton).show();
>
> but how to have the singleton function check the attribute value for
> src= ??

Reply via email to