jQuery .delay does not delay -


how can set html of element, wait 2 seconds, set html else?

example: $("div").html("clicked").delay(2000).html("2 seconds have passed");

what happens: div gets "2 seconds have passed" off bat, instead of saying "clicked" 2 seconds, displaying "2 seconds have passed".

do need like, .delay(2000, function() { $("div").html("2 seconds have passed"); })?

live example here: http://jsbin.com/ufayusu/1/edit

thanks!

$.delay used delay animations in queue, not halt execution.

try this:

settimeout(function() {       // after 2 seconds }, 2000); 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -