I am trying to get video URL using JavaScript. Code is ...
var vids = document.getElementsByTagName('video')
// vids is an HTMLCollection
for( var i = 0; i < vids.length; i++ ){
console.log( vids.item(i).src )
}
Seems to work for me! Note, that turns an HTMLCollection. .length
gives the length and item(i)
gives the item at i
.
var vids = document.getElementsByTagName('video')
// vids is an HTMLCollection
for( var i = 0; i < vids.length; i++ ){
console.log( vids.item(i).src )
}