tags:

views:

32

answers:

1

I'm really new to Jquery and I know my code below is wrong. Can someone help me fix it so it works properly?

Here is my code.

$(document).ready(function() {
    setTimeout(function() {
    $('a.delete').click(function(){
    $("div.delete-banner").delay(6000).fadeOut();
      // prevent default action
      return false;
    },5000);
    });
});
+4  A: 

You have passed the second argument for setTimeout() to the click() function instead. It can help to properly indent your code so you can spot things like this easier:

$(document).ready(function() {
    setTimeout(function() {
        $('a.delete').click(function(){
            $("div.delete-banner").delay(6000).fadeOut();
            // prevent default action
            return false;
        });     // <- Moved from here
    }, 5000);   // <- To here
});
Andy E