Timeout doesn't work

function updateimage(){
 $("#fileimg").attr("src","secondimage.jpg");
 $('#fileimg').fadeIn('slow');
}
setTimeout(updateimage(), 5000);

This is the code i tried. Its a code to reload the image every 5 seconds. But it doesn't work. I get this error in IE: Invalid argument Can y'all help me? Thanks.

Answers


2 options.

setTimeout("updateimage()", 5000)

or

setTimeout(function() {
    updateimage();
}, 5000);

You should pass the actual function as argument and not the call:

setTimeout(updateimage, 5000);

Try

setTimeout('updateimage()', 5000);


Need Your Help

NodeJS requiring modules

node.js node-modules

First off, I am a totally new developer with regards to Node.js.

How to expand Jquery Slider Panel programatically?

c# javascript jquery asp.net-2.0

I have JQuery Silder panel for Login | Register option. for referencing i have include demo of this slider Jquery Login | Register Slider Panel

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.