I have a JS function that returns a list of ".youtube" elements, loops through the selector, and calls another function. The JavaScript function is working beautifully, but I want to translate it into jQuery. Here's the JS function, which works correctly:
var videos = document.querySelectorAll(".youtube");
for (var i = 0; i < videos.length; i++) {
getVideos(videos[i]);
}
Now here's my attempt at translating it into jQuery:
$(".youtube").each(function(i, youtube){
getVideos(youtube[i]);
});
This doesn't work. Here's a JSFiddle: http://jsfiddle.net/k3y3yvxq/2/