Santiago
Santiago

Reputation: 261

How to nicely remove a table tr with jQuery?

I'm trying to smoothly remove the first tr of my table by doing:

$("#table_id").children().first().fadeOut('slow');

But the tr just disappears without any nice effect. Actually, this is not working either for any jQuery effect (slideUp, animate, hide('slide', ...), etc).

Any thoughts of how to solve this issue?

Upvotes: 1

Views: 1467

Answers (3)

Town
Town

Reputation: 14906

IE8 apparently doesn't handle the smooth fade and exhibits the behaviour you describe, whereas Chrome worked fine.

Adding filter: inherit inline seems to do the trick, although it's a dirty workaround: Demo

If you've got nested tables, then you can use eq(0) instead of :first-child to match the specific row:

$("#table_id tr:eq(0)").fadeOut('slow');

Upvotes: 1

Dan Blows
Dan Blows

Reputation: 21174

I've seen this on divs before - not sure if it's the same issue with a tr. However, try putting filter:inherit; on the tr.

Upvotes: 3

suhair
suhair

Reputation: 10929

Make sure you have not set jQuery.fx.off to true since it will disable all of the jquery animations.

Upvotes: 0

Related Questions