JQuery Redirect to URL after specified time

前端 未结 9 935
感动是毒
感动是毒 2020-12-07 17:20

Is there a way to use JQuery to redirect to a specific URL after a give time period?

9条回答
  •  感情败类
    2020-12-07 17:53

    $(document).ready(function() {
        window.setInterval(function() {
        var timeLeft    = $("#timeLeft").html();
            if(eval(timeLeft) == 0) {
                    window.location= ("http://www.technicalkeeda.com");
            } else {
                $("#timeLeft").html(eval(timeLeft)- eval(1));
            }
        }, 1000);
    });
    

提交回复
热议问题