user6733315 user6733315 - 1 year ago 64
jQuery Question

Why hide() is behaving differently?

I want to remove the element by clicking on them(one by one). I almost done .but little problem.

I write this code. this work fine .But this works only for

.these two example make effect only to the element on which i click.
TRY it

var k = $("<p></p>").text("paragraph");


But the problem is i want to remove the element
But when i try to
with same method. it only hides the bottom element.

Can someone Explain why this different behaviour for
. and a better solution for my problem. Please help.

Answer Source

hide and remove workes the same way. But both don't have a animation time by default. So both are so fast, that it visible seems, that the last row would be removed. But the truth is, that the bottom elements slide up to the new empty space in the list.

You can see the correct behavior when giving hide a time for it's animation:


Working example.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download