Dail
Dail

Reputation: 4606

Why FadeOut is not working?

Take a look at this code:

<script>
$(function(){
  $("div.note a").live("click", function(e) {
    e.preventDefault();

    answer = confirm("Delete?");    
    if (!answer) return false;

    $(this).parent().fadeOut('slow', function(){
      $(this).remove();
    });
  });  
});
</script>

<div id="note_list">
  <div class="note">
    Text: 
    <a href="#">X</a>
  </div>  
  <div class="note">
    Text: 
    <a href="#">X</a>
  </div>
  <div class="note">
    Text: 
    <a href="#">X</a>
  </div>
  <div class="note">
    Text: 
    <a href="#">X</a>
  </div>   
</div>

Could somone tell me why the fadeout is not working? after the click the div is deleted but i don't see the fedeout effects. Why?

Upvotes: 0

Views: 115

Answers (2)

Moin Zaman
Moin Zaman

Reputation: 25445

you could also try .fadeTo(3000,0,function(){$(this).remove();})

Upvotes: 0

Soufiane Hassou
Soufiane Hassou

Reputation: 17750

It is working, I made a fiddle for you.

If for some reason you still can't see it, try to replace 'slow' by a number of milliseconds, something big enough like 3000 should do it.

Upvotes: 3

Related Questions