setInterval(function, milliseconds, param1, param2, ...)
Parameters: This function acceps the following parameters:
- function: Thi sparameter holds the function name which to be called periodically.
- milliseconds: This parameter holds the period, in milliseconds, setInterval() calls/executes the function above.
- param1, param2, … : Some additional parameters to be passed as input parameters to function.
Return Value: This method returns the ID representing timer set by the method. This ID can be used to clear/unset the timer by calling clearInterval() method and passing it this ID as a parameter.
- Before clicking the button:
- After clicking the button:
In the above example, the setInterval() method repeatedly evaluates an expression/calls a function. The way to clear/unset the timer set by setInterval() method is to use the clearInterval() method and passing it the ID/value returned on calling setInterval().
- Difference between Call by Value and Call by Reference
- How to call PHP function on the click of a Button ?
- How to call PHP function from string stored in a Variable
- Call a parent window function from an iframe
- How to call a function automatically after waiting for some time using jQuery?
- How to remove error Call to undefined function curl_init()?
- How to call functions after previous function is completed in jQuery ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.