I am trying to accomplish something like this
var audios = $('audio');
for(var i = 0; i< audios.length;i++){
if(audios[i].currenTime != 0)
audios[i].pause();
}
But when I use JQuery to do it it returns to me that it doesn’t have any method.
$('audio').each(function(){
if($(this).curentTime != 0){
$(this).pause();
}
});
Is there anything I am missing?
When using
.each()the callback receives the DOM element asthis. You can (and have to) use it directly instead of wrapping it with jQuery again.this$(this)$(this)[0], that’s like['Hello'][0]instead of'Hello'