Suppose I have the following HTML:
I would like to switch the src to bar2.jpg>
src
bar2.jpg>
When you do this:
$("#foo").attr("src", "bar2.jpg");
The previous src is replaced.
So you don't need:
$("#foo").removeAttr("src");