bah... so simple. If anyone else runs into this problem, just use the next function for jQuery:
$(document).ready(function(){ $('.video').hide(); $('.videoLink').click(function(){ $(this).next(".video").toggle("slow,"); }); }); That's it, that does it all. Finally I got it. On Nov 24, 9:24 pm, Photonic <tmlew...@gmail.com> wrote: > I have pretty much given up... I don't think it is possible. So > instead I was going to use individual names... but thats not even > working: > > var videoLinks = $('.videoLink') > > for(var X = 0; X < videoLinks.length; X++) { > $('#videoLink' + X).bind('click', function() { > alert('#video' + X); > }); > } > > The problem is that it binds the link to "'#video' + X"... not a > parsed version of it. So even after they are bound, if X changes > value, so do they. That is bad because they all end up > #videoLastNumberOfArrayLength... any way to parse it into a string > that won't change...? > > On Nov 24, 6:04 pm, Photonic <tmlew...@gmail.com> wrote: > > > 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?