jquery 2 fades complete at the same time

Posted by odavy on Stack Overflow See other posts from Stack Overflow or by odavy
Published on 2010-04-16T09:49:49Z Indexed on 2010/04/16 9:53 UTC
Read the original article Hit count: 131

Filed under:
|
|

Hello again, just another quick one:

I am noticing differences with fadeOut dependant on whether this is a target. Here's my structure.

I have rows of data on my page, and each row has two icons. One is an update icon for that row, one is a delete icon for that row. When a user clicks the update icon for a particular row, I want both the update and the delete icons to fade away. So, in order to fade the thing the user clicked (the update button) and its corresponding delete button, I am using...

$(this).next().add(this).fadeOut('slow');

...which works, but the two elements don't fade at the same time. this fades first (which is the update icon), and then this.next fades out (the delete icon). But if I specify the two elements by name...

$('#updS2, #delS2').fadeOut('slow');

then they fade together. Why is it different?

Apologies for Friday rambling.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about fade