this question has answer here:
- how video tag src using javascript? 2 answers
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);