I have an ‘a’ list like this:
<div id="page">
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>
</div>
For now I have to set the list as HTML, but since I’m going to use ~500 times ‘a’ I need it be generated as result of some jquery event.
The total amount of ‘a’ tags is given by SomeFunction();
How can I generate (for instance on .click) the exact amount of ‘a’ tags given by SomeFunction(); ?
ps The html numbers should also be generated.
Assuming
SomeFunction()simply returns an integer:Example fiddle
DO NOT call
append()500 times as others have suggested – it will be incredibly slow.