I have this playlist script, in it I wanted the name of the selected video in the playlist to turn to P tag
$(document).ready(function() {
video = $("#video");
nome = $("#nome");
init();
function init() {
current = 0;
playlist = $("#playlist");
tracks = playlist.find("li a");
len = tracks.length;
playlist.find("a").click(function(e) {
e.preventDefault();
link = $(this);
current = link.parent().index();
run(link);
});
$("#anterior").on("click", function(e) {
current--;
if (current == len) {
current = 0;
link = playlist.find("a")[0];
} else {
link = playlist.find("a")[current];
}
run($(link));
});
$("#proximo").on("click", function(e) {
current++;
if (current == len) {
current = 0;
link = playlist.find("a")[0];
} else {
link = playlist.find("a")[current];
}
run($(link));
});
}
function run(link) {
video.src = link.attr("href");
nome.innerHTML = link.innerHTML
par = link.parent();
par.addClass("active").siblings().removeClass("active");
video.load();
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script><pid="nome"></p>
<video id="video" width="200px" controls class="player" src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4">Videonaosuportado</video><divid="anterior">proximo</div>
<div id="proximo">anterior</div>
<ul id="playlist">
<li class="active"><a href="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4">Big Buck Bunny 1</a></li>
<li><a href="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4">Big Buck Bunny 2</a></li>
<li><a href="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4">Big Buck Bunny 3</a></li>
</ul>