Can I put delay(500) before an addClass()? Can I put delay(500) before an addClass()? jquery jquery

Can I put delay(500) before an addClass()?


delay only works with animating methods, you can use setTimeout function:

$("#info-text-container").click(function(){    setTimeout(function(){       $("#info-text").addClass("info-text-active");   }, 500);});


Not quite like that, but like this for example:

$("#info-text").delay(500).queue(function(next) {  $(this).addClass("info-text-active");  next();});