[jQuery] Re: adding a class to an object if the next object has the same attribute value.

2009-01-08 Thread peet
Nice Works perfectly. Exactly what i need. Never considered the function each for this purpose!. On Jan 7, 5:07 pm, Ricardo Tomasi wrote: > In this line: > > $(".row > div").next("[Type="+$(this).attr("Type")+"]") > > 'this' is refering to the 'window' object or some other context, not > the ele

[jQuery] Re: adding a class to an object if the next object has the same attribute value.

2009-01-07 Thread Ricardo Tomasi
In this line: $(".row > div").next("[Type="+$(this).attr("Type")+"]") 'this' is refering to the 'window' object or some other context, not the element you just selected. $('.row > div').each(function(){ //inside each 'this' is the current element var $this = $(this), next = $this.next();