Is it possible to use chaining when using setTimeout(). This example gives a div a red background, then I use setTimeout() to wait a second and make the background back to normal. can it be re-written or improved in any way
$(target).css('background', 'red');
setTimeout(function(){
$(target).css('background', '');
}, 1000 );
You’ll get a performance improvement if your cache your jQuery call: