Something as simple as:
$("#div").addClass("error").delay(1000).removeClass("error");
doesn't seem to work. What would be the easiest alternative?
Something as simple as:
$("#div").addClass("error").delay(1000).removeClass("error");
doesn't seem to work. What would be the easiest alternative?
AFAIK the delay method only works for numeric CSS modifications.
For other purposes JavaScript comes with a setTimeout method:
delay
does not work on none queue functions, so we should usesetTimeout()
.And you don't need to separate things. All you need to do is including everything in a
setTimeOut
method: