Run Function After Delay

前端 未结 4 851
青春惊慌失措
青春惊慌失措 2021-01-30 01:57

I have the below global jQuery function stored, but on page load, I want to execute it after a 1000 delay. Is there something wrong with my syntax? I know the delay always goes

4条回答
  •  日久生厌
    2021-01-30 02:49

    You can add timeout function in jQuery (Show alert after 3 seconds):

    $(document).ready(function($) {
        setTimeout(function() {
         alert("Hello");
        }, 3000);
    });
    

提交回复
热议问题