<a href="https://cs.pikabu.ru/post_img/2013/05/01/6/1367393426_294080549.png">Click Me</a>
<img src="" alt="">
body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
const link = document.querySelector('a');
const img = document.querySelector('img');

link.addEventListener('click', function(e) {
  e.preventDefault();
  img.src = this.href
})

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.