Help, How do you Hide and Show Video?

2 replies
Hello, I already knew how to create a Hide and Show with video but my problem is I dont know how to make a 2 or more with something like that. When I tried duplicating the code it just show as the original.

I want to make something like Video 1 Youtube, Video 2 Vimeo etc.

Can you help me about this. Thankx

<<script type="text/javascript">
function toggle(obj) {
var obj=document.getElementById(obj);
if (obj.style.display == "block") obj.style.display = "none";
else obj.style.display = "block";
}
</script>

<a href="javascript: void(0);" onClick="toggle('q1')">Question 1</a>
<div id="q1" style="display:none;"><iframe width="560" height="315" src="//www.youtube.com/embed/wRcVgJjnFLo" frameborder="0" allowfullscreen></iframe></div>
#hide #show #video
  • Profile picture of the author David Beroff
    Change the "q1" to "q2" in the second instance.
    Signature
    Put MY voice on YOUR video: AwesomeAmericanAudio.com
    {{ DiscussionBoard.errors[9072214].message }}
  • Profile picture of the author K Meier
    As david already explained, you would need to change the ID in the HTML code. Both the div id and the toggle id.

    onClick="toggle('q1')" becomes onClick="toggle('q2')"
    <div id="q1" becomes <div id="q2"

    and so on.
    {{ DiscussionBoard.errors[9074756].message }}

Trending Topics