jQuery autohide element after 5 seconds

前端 未结 8 1403
刺人心
刺人心 2020-11-29 17:53

Is it possible to automatically hide an element in a web page 5 seconds after the form loads using jQuery?

Basically, I\'ve got

8条回答
  •  鱼传尺愫
    2020-11-29 18:33

    This is how you can set the timeout after you click.

    $(".selectorOnWhichEventCapture").on('click', function() {
        setTimeout(function(){
            $(".selector").doWhateverYouWantToDo();
        }, 5000);
    });
    

    //5000 = 5sec = 5000 milisec

提交回复
热议问题