jQuery addclass removeclass with interval and fadein
<p>I would like to add a class to an element for only 3 seconds then remove it smoothly by fadeout.</p>

<p>This is what I have so far</p>

<pre><code>var row = $("#foo").addClass('alert-success');
setTimeout(function () {
   row.removeClass('alert-success');
}, 2000);
</code></pre>

<p>This adds class to foo then removes it after 2 secs abruptly. How can I make it fadeout smoothly or use the fadeOut function without removing the element foo?</p>
