Vadim Tatarnikov Vadim Tatarnikov - 1 year ago 44
Javascript Question

Function only called once from $(function(){

So in my js script I use jQuery, at the top I wrote:

$(function() {
function myFunc() {

is only printed once which means
only ran once, I want it to run every frame/millisecond or basically as fast as it can over and over and over again. Why doesn't it happen like so? If I'm doing it wrong, how can I achieve the effect I want, and what is my mistake?

Answer Source

@Vadim Tatarnikov to call as soon as faster a function in jquery use window.setInterval() with minimum time interval try the below code

<script type="text/javascript" src="jquery.js"></script>//add your jquery script file 

<script type="text/javascript">
},1);//here i put time interval=1 nanosecond
function myFunc(){

This will call myFunc() in every 1 nanosecond just run and see the console.