[jQuery] Is there a way of counting the number of id's with the same name, and then renaming them _1, _2, _3 etc.

[jQuery] Is there a way of counting the number of id's with the same name, and then renaming them _1, _2, _3 etc.


Hi,
I am dynamically generating html which looks like this:
<div id="wrapper">

Some Content


</div>
<div id="wrapper">

Some Content


</div>
<div id="wrapper">

Some Content


</div>
I need to write some jquery which will turn that into this:
<div id="wrapper_1">

Some Content


</div>
<div id="wrapper_2">

Some Content


</div>
<div id="wrapper_3">

Some Content


</div>
Any ideas?
Dave