This is quite good. It works as long as the list elements contain just text.
My unordered list is a menu. So each list element contains a link.
How could the code be modified to work with this UL:
<ul class="menu">
<li><a href="#">Link to somewhere</a></li>
<li><a href="#">Another link</a></li>
etc.
</ul>