您好我想從div中獲取標籤值並將其顯示在html div標籤中。我正在構建一個帶有播放列表的html5視頻播放器,到目前爲止,我點擊視頻更改的縮略圖,並且每次都向div添加不同的標籤。我想在html中打印該標籤,並在每次顯示新視頻時進行更改。我已經嘗試了一些東西,但無法讓它工作。的jsfiddle https://jsfiddle.net/zo8tcuxs/1/從div中獲取標籤值並在html中顯示
我的代碼是:
<section id="video-container">
<video id="videoarea" controls="controls" poster="" src="" id="video1" ></video>
<div id="description" label="" type="text"> </div>
<ul id="playlist">
<li id="videoweek1" movieurl="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" label="This is video number 1 " type="video/mp4" moviesposter="http://html5videoformatconverter.com/data/images/screen.jpg">
<img src="http://html5videoformatconverter.com/data/images/screen.jpg" class="video-thumbnail">
</li>
<li id="videoweek2" movieurl="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" label="This is video number 2 " type="video/mp4" > <img src="http://html5videoformatconverter.com/data/images/screen.jpg" class="video-thumbnail"></li>
</ul>
</section>
$(function() {
$("#playlist li").on("click", function() {
$("#videoarea").attr({
"src": $(this).attr("movieurl"),
"poster": "",
"autoplay": "autoplay"
})
})
$("#playlist li").on("click", function() {
$("#description").attr({
"label": $(this).attr("label")
})
})
$("#videoarea").attr({
"src": $("#playlist li").eq(0).attr("movieurl"),
"poster": $("#playlist li").eq(0).attr("moviesposter")
})
})