Hi, I don't really know if my solution is universal but in this case works fine:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="http://tablesorter.com/jquery-latest.js"></script> <script type="text/javascript"> jQuery(function(){ var nodes = new Array(); nodes = $(".modAccordion").children(); $(".modAccordion").children().remove(); var i = 0; var headerTest = /.(Head)./; while(i < nodes.length) { var testNode = nodes[i].toString(); if((testNode.match(headerTest))){ $(".modAccordion").append(nodes[i]); i++; var newDiv = document.createElement("div"); newDiv.className="new"; while(i < nodes.length && !((nodes[i].toString()).match (headerTest))) { newDiv.appendChild(nodes[i]); i++; } $(".modAccordion").append(newDiv); } } }); </script> <style> div.new { background: #00ff00; } .modAccordion { background: #ff0000; } </style> <title>TableSorter</title> </head> <body> <div class="modAccordion"> <h3>header 1</h3> <p>some text</p> <p>some other text</p> <h3>header 2</h3> <p>some text</p> <ul> <li>list element 1</li> <li>list element 2</li> </ul> <h3>header 3</h3> <p>some text</p> <p>some other text</p> <p>some more text</p> <p>some different text</p> </div> </body> </html> On 14 Lis, 13:12, hagbardceline <hagbardcelin...@gmail.com> wrote: > Anyone got an idea? Have no clue so far. > Does a regular expression help?