sorry, but this isn't easy for me....! I want a div to show after several seconds,after a click on a button. It is showing, but right when you click, there is no delay. What am i doing wrong here?
$('div.skill').hide();
$('.btn_2').click(function(e){
showSkills ();
});
function showSkills(){
alert("Hello")
};
setTimeout ( "showSkills()", 3000 );
Tnx
You're close.
setTimeout call should be inside of your click handler, not below it.This is the proper way to achieve what you're after:
$('div.skill').hide();
$('.btn_2').click(function (e) {
setTimeout(showSkills, 3000);
});
function showSkills() {
alert("Hello")
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With