JQuery coding problem
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);
});
});
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
});
精彩评论