I guess that inside the anonymous functions within toggle, 'this' is no longer the 'this' that you intend it to be. Try setting a variable to the 'this' you want outside of the toggle instead - like so:

 $(".toggle_cat a").each(function(i){
  $(this).attr("title", "Click here to exclude this cat");
  $(this).click(function(event){
   $(this).toggleClass("selected");
   var self = this; /* saves your 'this' for use in the toggle */
   $("." + this.rel).toggle(
       function() { $("." + self.rel).hide('slow'); },
       function() { $("." + self.rel).show('fast'); }
   );
  });
 });

Joel.


On 04/04/2007, at 10:16 PM, Sebastián V. Würtz wrote:

 $(".toggle_cat a").each(function(i){
  $(this).attr("title", "Click here to exclude this cat");
  $(this).click(function(event){
   $(this).toggleClass("selected");
   $("." + this.rel).toggle(
       function() { $("." + this.rel).hide('slow'); },
       function() { $("." + this.rel).show('fast'); }
   );
  });
 });

Reply via email to