Javascript using element ID to play video

Soldato
Joined
27 Dec 2005
Posts
17,296
Location
Bristol
I'm not adept at Javascript and I need to play a video on the click of an element based on its ID.

The page is at jonesmillbank.com/our-clients/newmarket. The current JS is unique to each element, for example:

Code:
<script>
$(document).ready(function(){
	$("#rhine").click(function(){
	$("#hiddenvid").show(50);
	$("#hiddenvid iframe").attr('src', '//www.youtube.com/embed/vxWBxx-JfDM/hqdefault.jpg?rel=0&showinfo=0&autoplay=1');
	});
});
</script>

<a id="rhine"><div class="content c4" style="background-image:url(../../../images/work/newmarket2.jpg)">
<p class="pimage">Rhine River Cruise</p>
</div></a>

I just want it so that it's '<a id="vxWBxx-JfDM">' instead and that passes to the iframe.

Thanks!
 
Back
Top Bottom