JSFiddle - React, Tailwind, and code Playground

by Nam CuPeo

HTML

<div class="separator" style="clear: both; text-align: center;">
<iframe id='dkm' allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/6oJrdDmk8dI/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/6oJrdDmk8dI?feature=player_embedded" width="320">
</iframe></div>
<img id="anhdaidien"/>

JavaScript

//tạo hàm không có biến
function laylk()
{
// lấy thuộc tính data-thumbnail-src trong thẻ iframe đầu tiên (0) rồi gán cho biến lienket
var lienket = document.getElementsByTagName('iframe')[0].getAttribute('data-thumbnail-src');
// gán thuộc tính src của thẻ img bằng biến lienket
document.getElementById('anhdaidien').setAttribute('src',lienket);
}
laylk();