Currently, I am dynamically pulling content into li elements using ASP.NET. My goal is to wrap a specific div class around the first 3 li items in the list only. Here is an example:
<ul class="wrapper">
<div class="recommend">
<li><a href="#"><img src="#" /></a></li>
<li><a href="#"><img src="#" /></a></li>
<li><a href="#"><img src="#" /></a></li>
</div>
<li><a href="#"><img src="#" /></a></li>
<li><a href="#"><img src="#" /></a></li>
<li><a href="#"><img src="#" /></a></li>
<li><a href="#"><img src="#" /></a></li>
<li><a href="#"><img src="#" /></a></li>
</ul>
I have come across a fiddle that is close to achieving this desired result, which I have found and modified. Here is the link to the fiddle: http://jsfiddle.net/ZuK4E/. However, the fiddle applies the modification to every 3 li items instead of just the first 3. Since all lis are the same, I am unable to target any specific ones using ids.