Add href to links dynamically
<p>I have a series of horizontal div boxes that I need to add the relevant href to link to the next one with anchorlinks. As they are produced dynamically I need to add the href with JavaScript.</p>

<p>The desired effect will be:</p>

<pre><code>&lt;div id="post1"&gt;
&lt;a class="next-video" href="#post2"&gt;NextVideo&lt;/a&gt;
&lt;/div&gt;

&lt;div id="post2"&gt;
&lt;a class="next-video" href="#post3"&gt;NextVideo&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>Added the script </p>

<pre><code>$('.next-video').each(function(index) {
    $(this).attr('href', '#post' + (index + 2));
});
</code></pre>

<p>but doesn't seem to target the <code>.next-video</code> class, this is the live version:
<a href="http://www.warface.co.uk/clients/detail-shoppe/test-scroll" rel="nofollow">http://www.warface.co.uk/clients/detail-shoppe/test-scroll</a></p>

<p>Many thanks</p>
