<script> $().ready(function() { $('.menu ul').each(function(){ $(this).wrap("<a href=\"cat/"+$(this).html()+"/\"></a>"); }); }); </script>