JavaScript:
$(document).ready(function(){ function sample() { alert("This is sample function"); } $("#button").click(function(){ t = setTimeout("sample()",2000); }); });
HTML:
<input type="button" id="button" value="Call sample function with delay">