$.fn.animateHighlight = function(highlightColor, duration) { var highlightBg = highlightColor || "#FFFF9C"; var animateMs = duration || 1500; var originalBg = this.css("backgroundColor"); this.stop().css("background-color", highlightBg).animate({backgroundColor: originalBg}, animateMs); };
Used like this:
$("#PortfolioBeta").text(result.PortfolioBeta).animateHighlight("#FFBD1A", 1000);
Simplest pulse ever.