Changing src of two images on click

Changing src of two images on click

I want to swap the source of two images when you click on one image. Basically, I am switching on/off states. But I can't even get the first part to work. Here is a function that I would think replace the word "off" in the image file name with "on" when you click on an image with the class .img-swap. After that I would imagine I would toggle the class of each somehow.

  1. $(".img-swap").click(function () {

  2.          $(this).attr("src").replace("-off", "-on");
  3. });