开发者

Can we end a callback function in Jquery from outside the function

开发者 https://www.devze.com 2023-01-06 14:51 出处:网络
I am using the time-ticker function by David Walsh. I did manage to return false from within the callback function, whenever I had to create a new instance, 开发者_StackOverflowand wrote a new instanc

I am using the time-ticker function by David Walsh. I did manage to return false from within the callback function, whenever I had to create a new instance, 开发者_StackOverflowand wrote a new instance altogether. But it would be far more clean code if I could somehow update the call back function form within. Please let me know, even if it is something more general. Thanks in advance :)


You can supply whatever callback you like... it is one of the settings - so if you wanted to end the callback, you just need to return out of it.

$('#countdown').countDown({
    startNumber: 10,
    callBack: function(me) {
        $(me).text('All done! This is where you give the reward!').css('color','#090');
        alert("You can do anything here");
        // Including calling another function
        DoSomething();
        return false;
    }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消