My Js code in the bottom is working properly for first link, but not for the second, even if I refresh the page it works only for first link, any idea how to solve this? thank you.
<div class="container">
<div class="list">
<li><a data-video="https://www.youtube.com/embed/PkZNo7MFNFg" href="#">Vido 1</a></li>
<li><a data-video="https://www.youtube.com/embed/7bE2mI4ePeU" href="#">Vido 2</a></li>
<br>
<br>
</div>
<div class="vid">
<iframe id="videos" width="760" height="415" style="background: #ccc;" src="" frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
</div>
</div>
<script>
let clicked = document.querySelector('a').getAttribute('data-video');
document.querySelector('a').addEventListener('click', () => {
document.querySelector('iframe').src = clicked;
});
</script>