How to call a jquery function onload with some delay?
I want to call a function like this on load with some delay
$(".sample").live('click',function(){
var id=$(this).attr("id");
How to call a jquery function onload with some delay?
I want to call a function like this on load with some delay
$(".sample").live('click',function(){
var id=$(this).attr("id");
you could use setTimeout function you must refactor your code as something like this
//2 seconds wait before calling doJob
$(".sample").live('click',function(){ setTimeout(doJob, 2000);});
function doJob(){
var id=$(this).attr("id");
//other statements ...
}