I need to change image on click to another image.

In my example on [jsfiddle](https://jsfiddle.net/Frunky/7kp3xbur/1/) it works

But on my Wordpress site, it doesn't work and I don't know why. Click event doesn't work, but if I add alert('1')(for example) it works only one time.

```
jQuery('.thumbnails img').click(function() {
    var attr = jQuery(this).attr('src');
    var src = jQuery('.main-image img').attr('src');
    jQuery('.main-image img').attr('src', attr);
    jQuery(this).attr('src', src);
});

<div class="images">
  <div class="main-image">
    <img src="https://www.w3schools.com/css/img_fjords.jpg">
  </div>
  <div class="thumbnails columns-3" style="display: block;">
    <img width="184" height="123" src="https://s3-us-west-1.amazonaws.com/powr/defaults/image-slider2.jpg" class="attachment-shop_thumbnail size-shop_thumbnail">
  </div>
</div>

```

Where's my mistake?

Thanks