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.
- $(".img-swap").click(function () {
- $(this).attr("src").replace("-off", "-on");
-
- });