How Can I Toggle Between 2 Images

An example of toggling between 2 images:

Below is the source code for creating the like button shown above: