Can anyone help me with this code? I want to convert this jQuery code to vanilla Javascript, but I am not well familiar with Javascript, so I am stuck.
Here is my code:
$('.video-card a').each(function() {
var data = $(this).attr('data');
$(this).append('<img src="http://img.youtube.com/vi/'+data+'/maxresdefault.jpg" />');
});
$('.video-card a').click(function() {
var data = $(this).attr('data');
$('#loader').append('<iframe src="https://www.youtube.com/embed/'+data+'" frameborder="0" allowfullscreen></iframe>');
$('#overlay').fadeIn(250);
});
Any suggestion will be appreciated.