Function not executed at all

Discussion in 'jQuery' started by xms, Jan 29, 2018.

  1. #1
    I have a function called valvonta. I would like to run it every 6 secs. What is wrong here?

    var toista_valvonta;
    toista_valvonta = setTimeout(function() { valvonta }, 6000);
    
    (function valvonta() {
    alert('yes');
    })();
    Code (JavaScript):
     
    xms, Jan 29, 2018 IP
  2. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,278
    Likes Received:
    1,696
    Best Answers:
    31
    Trophy Points:
    475
    #2
    
    var toista_valvonta;
    function valvonta(){
    toista_valvonta = setTimeout(valvonta, 6000);
       alert('yes');
    }
    valvonta();
    
    Code (markup):
     
    qwikad.com, Jan 29, 2018 IP
    sarahk likes this.