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();
   if (next.attr('type') == $this.attr('type')) next.addClass('RED');
});

On Jan 7, 7:05 am, peet <peetkl...@gmail.com> wrote:
> Hello to you all,
>
> I have looked in this group and could not find anyone trying the same
> thing as i am trying to accomplish.
>
> I am trying to add a class to an object if the next object has the
> same attribute. I don't know the name of the attributes value the 2
> have in common.
>
> the code i have is:
> $(".row > div").next("[Type=SameValue]").addClass("RED");
>
> This works fine.
>
> but i want to replace the "SameValue" with something like  but somehow
> this doesn't work:
>
> $(".row > div").next("[Type="+$(this).attr("Type")+"]").addClass
> ("RED");
>
> I am trying to make the border between the same fields disappear so it
> looks like one big box. in a calendar view.
> Is there somebody who has accomplished something similar or has an
> idea how i can do this?
>
> best regards

Reply via email to