Reputation: 1005
I'm trying to figure out how to change the video within this iframe upon clicking the blue button. So, in other words, clicking the blue button will change the video that's playing in the iframe.
If anyone has ideas of how to do this, please let me know...
HTML
<div id="stage">
<iframe width="560" height="315" src="https://www.youtube.com/embed/e-ORhEE9VVg" frameborder="0" allowfullscreen></iframe>
</div>
<br>
<div id="button">Click me</div>
CSS
#button{
background:blue;
cursor:pointer;
width:200px;
margin-left:auto;
margin-right:auto;
color:white;
}
jQuery
$(document).on('click', '#button', function(event) {
});
Upvotes: 0
Views: 133
Reputation: 5812
Consider this:
$( "#button" ).click(function() {
$("#stage > iframe").attr("src", "http://www.wp.pl");
});
Where http://www.wp.pl
is just a link for you to replace. You can always try to do it with somekind of loop to get more songs.
Upvotes: 2