How to set time dealy before executing function in javascript/jquery

Here I will show you that how can we set some delay before executing a function in javascript.
It is very simple to do it. you just need to use setTimeout() function of Javascript.
Bellow is sample example.

function NewFunction()
{
setTimeout(function(){alert("Hello, It showed after 3 seconds")},3000);
}

In above example after 3 seconds of calling NewFunction(), alert “Hello, It showed after 3 seconds” will be displayed.
3000 means 3 seconds i.e. you can set your desired delay time for your function.

admin