setTimeout stack over flow..
$(document).ready(function(){
counterFN();var theCounter = 1; function counterFN() { $(".searchInput").val(theCounter); theCounter++; setTimeout(counterFN(),1000); } }); </script> </head> <body> <input type="text" class="searchInput" /> </body> </html>
setTimeout stack over flow.. $(document).ready(function(){ counterFN(); var theCounter = 1; function counterFN() { $(.searchInput).val(theCounter);
Share
You are calling counterFN and setting its return value to run after 1000 milliseconds. Since you aren’t returning a function, you probably don’t want to do that.
You probably want:
Better yet, don’t be recursive, and do more caching of things that won’t change: