I am new to jQuery, and I attempted to search this forum, as well as
go through most of the tutorials. I could not find out if this was
possible. I am attempting to create a list of links that, when
clicked, will show a div section below them. Now, I can do that
individually. However, I would like to dynamically add that
functionality to all the videos at once, without having to use
different ids/class names for each.
example:
<ol>
<li>
<a href="#" class="videoLink">Click this to show video</a>
<div class="video">VIDEO - will be hidden until link is clicked</
div>
</li>
<li>
<a href="#" class="videoLink">Click this to show video</a>
<div class="video">VIDEO - will be hidden until link is clicked</
div>
</li>
<li>
<a href="#" class="videoLink">Click this to show video</a>
<div class="video">VIDEO - will be hidden until link is clicked</
div>
</li>
</ol>
This is what I have so far:
$(document).ready(function(){
var videos = $('.video');
var links = $('.videoLink');
videos.hide();
});
Now, is it even possible to tell the links to show their respective
video?