To delay javascript function call using jquery
- by Mohan Ram
CODES:
$().ready(function(){
function sample()
{
alert("This is sample function");
}
$("#button").click(function(){
t=setTimeout("sample()",2000);
});
});
HTML:
<input type="button" name="button" id="button" value="Call sample function with delay">
Once i click button sample function is not called with a delay of 2 seconds. I dont know whats wrong. Please notify me how to do this
Question: To call javascript function using setTimeout via jquery