javascript - How to get video src attribute -


this question has answer here:

i need src attribute of video tag, wrong:

<video id="vdisk" controls poster="placeh/02.jpg">     <source src="placeh/01.mp4" type="video/mp4"> </video> 

javascript

var = $("#vdisk").attr("src"); console.log(a); // undefined 

as source descendant of #vdisk, try :-

var = $("#vdisk source").attr("src"); console.log(a); 

reference