How to disable a button with a timed loop?

后端 未结 1 1432
长情又很酷
长情又很酷 2021-01-29 02:29

i\'m trying to disable a button for 6 seconds while in a loop but so far I can\'t quite figure it out.

var disabledStartTimer = setInterval(disabledTimer, 1000);         


        
相关标签:
1条回答
  • 2021-01-29 03:19
    var start = 0;
    if (start > 6){
    

    Clearly this will always go into the else. You set the variable to 0 and then test if it's greater than 6... it isn't. You likely wanted this to be a global, move it outside of the function.

    0 讨论(0)
提交回复
热议问题