Possible Duplicate:
jQuery: Can I call delay() between addClass() and such?
Hello I have an issue.
The below jQuery code is not working for me..
$("#message").addClass("highlightError").delay(15000).removeClass("highlightError");
What's the error?
The class in not even added..I checked with Firebug, no errors are shown..
Please help
Thanks!|
removeClass
is not used by the effects queue, so delay has no effect on it. To cause it to be called in the effects queue, manually add it using queue()
:
$(function(){
$("#message").addClass("highlightError").delay(2000).queue(function(){
$(this).removeClass("highlightError");
$(this).dequeue();
});
});
Works here: http://jsfiddle.net/QkpJn/1