I have a list of 8 divs and need to add a sequence of class numbers to them using Jquery to style them individually. Need to add them to the 'content-block' div see example below.
The desired effect will be something like this:
<div class="wrapper">
<div id="content-block" *class="post1"*>
</div></div>
<div class="wrapper">
<div id="content-block" *class="post2"*>
</div></div>
I have added the script
**Javascript**
$('.post-block').each(function(i){
$(this).addClass('post' + i);})
but I need to link them with anchor links so I will need a way to add an ID to the post-block.
Desired effect
**HTML**
<div id="post1" class="post-block">
</div>
<div id="post2" class="post-block">
</div>
Many thanks