I want to create a list with incremented ids and hrefs using jQuery. Is this possible?
<ul id="links">
<li><a href="#item1">Item number 1</a></li>
<li><a href="#item2">Item number 2</a></li>
<li><a href="#item3">Item number 3</a></li>
<li><a href="#item4">Item number 4</a></li>
<li><a href="#item5">Item number 5</a></li>
</ul>
<div id="toShow">
<div id="item1" style="display:block;"></div>
<div id="item2" style="display:none;"></div>
<div id="item3" style="display:none;"></div>
<div id="item4" style="display:none;"></div>
<div id="item5" style="display:none;"></div>
</div>
These list items will be generated via a loop and I want to use this plugin http://www.bijusubhash.com/demo/show-hide-a-div-at-a-time-with-jquery/
Thanks,
David
I can assume that: What you need actually is much more simpler than you think:
demo link
HTML: (yes, NO custom ID’s mess)
And a couple of jQuery lines:
More info:
http://api.jquery.com/