How to get image caption changing

Hi, so practicing some web development code and the part im stuck on is when a button is clicked it changes to picture and the caption is supposed to change. However no matter what i try the caption remains the same.
The following is part of the code i have.