jquery - javascript setInterval timer issue -


the code :

function starttimer() {   var = 0;   var timeinterval = setinterval(function () {     $("#time").html(i++);   }, 1000);   settimeout(function () {     clearinterval(timeinterval);   }, 2000); } 

my problem $("#time").html(i++) 0 , not incrementing

<!doctype html> <html> <head> <script type = 'text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js'></script> <script> (function starttimer() {//selef executing function  var = 0;  var timeinterval = setinterval(function () {     $("#button").html(i++);    }, 1000);    })()//end of function </script> </head> <body>  <p id='button'></p>  </body>  </html> 

set time out should removed code work.see above code.it works


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -