There's a page of some damn tables that I'm trying to redo dynamically. Its a page I don't have control over so this code is running from a bookmarklet in my browser. I'm trying to sample out the content I want and re-wrap it in an an unordered list. I can't get the .wrap function to work.
The sample html looks like this: <table> <tr> <td class="title"> <a href="link">Link</a> </td> </tr> </table> I'm using this jQuery code to 1) sample the data I want. 2) destroy the contents of the page, write the start/end ul tags. 3) loop through the sampled data, wrap <li> tags around them, then append to the <ul>. However, it will write out the contents but doesn't wrap the <li> tags. anchors = $("td.title[valign!='top']").children(); $('body').html("<ul id='hn'></ul>"); anchors.each(function(){ $("#hn").append( $(this).wrap("<li></li>")); });