We have variable $menu
with HTML inside (there is no loop, it comes from a function).
On echo
it gives the code like this:
<ul id="menu">
<li id="some-id" class="many classes"><a title="one" href="#">text</a></li>
<li id="some-id" class="many classes"><a href="#">text</a></li>
<li id="some-id" class="many classes"><a title="three" href="#">text</a></li>
</ul>
What I want to do:
get value of the
title=""
of each link, and move it to the end of parent<li>
class.remove
title=""
from each link.
Code inside variable $menu
should become:
<ul id="menu">
<li id="some-id" class="many classes one"><a href="#">text</a></li>
<li id="some-id" class="many classes"><a href="#">text</a></li>
<li id="some-id" class="many classes three"><a href="#">text</a></li>
</ul>
What is the solution?