Reputation: 1385
My requirement is to execute some code after some amount of time..Here is my code but it is not working, Might be some problem with my code..
$(document).ready(function()
{
$.doTimeout(300,function()
{
$('xxxButton').trigger();
});
});
Upvotes: 1
Views: 127
Reputation: 36681
Using setTimeout
$(document).ready(function()
{
setTimeout( function() {
$('xxxButton').trigger('click');
}, 300 );
);
Upvotes: 1
Reputation: 434985
The trigger
function in jQuery requires an argument to tell jQuery which event type you want to trigger. I'd guess that you have a button of some sort with an id
attribute of xxxButton
and you want to click it, if so, then you want:
$(document).ready(function() {
$.doTimeout(300, function() {
$('#xxxButton').click();
});
});
You could also use $('#xxxButton').trigger('click')
if you really want to use trigger
.
Upvotes: 1
Reputation: 141937
doTimeout isn't a function. You want:
$(function(){
setTimeout(function(){
$('xxxButton').trigger();
}, 300);
});
$(function(){});
is a shortcut for $(document).ready(function(){});
btw
Upvotes: 1