Regroup element with jquery

Posted by kennygunie on Stack Overflow See other posts from Stack Overflow or by kennygunie
Published on 2010-06-07T17:09:29Z Indexed on 2010/06/07 17:12 UTC
Read the original article Hit count: 108

Filed under:

Hi,

I have a number of messages on my page like this:

<div class="messages">A</div>
<div class="messages">B</div>
<div class="messages">A</div>
<div class="messages">C</div>

is there any way with jQuery (no PHP) to count and regroup 2 div A like this:

<div class="messages">A</div><span>2</span>
<div class="messages">B</div>
<div class="messages">C</div>

Thank you.

© Stack Overflow or respective owner

Related posts about jQuery