how to change image src path?

how to change image src path?

What I'd like to do is change the path to images with the class .changsrc. Eventually I'll attach this to a link, but for now I only need it to happen on page load. I managed to change the entire image src using attr() but that doesn't work for multiple images with one class name. (maybe I'm missing something there)

So... how can I change
img src="images/imagename.jpg"
to:
img src="images/alt/imagename.jpg"

I'm thinking this must be simple but I've been searching for the solution and can't find it. Maybe because I don't know how to refer to this. Any help appreciated.

thx