jQuery.fn.justtext = function() { return $(this).clone() .children() .remove() .end() .text(); }; $(document).ready(function(){ $("h1").each(function(){ $("#sidebar").append( "

"+$(this).justtext()+"

" ); ul = $("