Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- var youtube = "https://www.youtube.com/embed/"
- $("button[data-url]").click(function() {
- var code = $(this).data("url")
- var video = youtube + code
- $("iframe").attr("src", video)
- })
- </script>
- <button type="button" data-url="WhateverCode1">Video 1</button>
- <button type="button" data-url="WhateverCode2">Video 2</button>
- <!--With src="" is so much faster -->
- <div class="embed-responsive embed-responsive-16by9">
- <iframe class="embed-responsive-item" src=""></iframe>
- </div>
- <!-- Than no src -->
- <div class="embed-responsive embed-responsive-16by9">
- <iframe class="embed-responsive-item"></iframe>
- </div>
Add Comment
Please, Sign In to add comment