I need to addclass or append class name same from content. Here is example.
<ul>
<li>
<a href="#">men</a>
<ul>
<li><a href="#">new arrival</a></li>
<li><a href="#">about</a></li>
</ul>
</li>
<li>
<a href="#">top 2nd menu</a>
<ul>
<li><a href="#">go</a></li>
<li><a href="#">hello menu</a></li>
</ul>
</li>
</ul>
Here is what I want as final result onload:
<ul>
<li class="men">
<a href="#">men</a>
<ul>
<li class="new-arrival"><a href="#">new arrival</a></li>
<li class="about"><a href="#">about</a></li>
</ul>
</li>
<li class="top-2nd-menu">
<a href="#">top 2nd menu</a>
<ul>
<li class="go"><a href="#">go</a></li>
<li class="hello-menu"><a href="#">hello menu</a></li>
</ul>
</li>
</ul>
See Question&Answers more detail:os