There are 2 lists.
The first:
<ul> <li class="lek" id="867" class="lek"> <span class="867">text1</span> </li> <li class="lek" id="865" class="lek"> <span class="865">text2</span> </li> <li class="lek" id="863" class="lek"> <span class="863">text3</span> </li> </ul>
Second:
<ul> <li> <a class="859 866 870" href="detail.php?id=933">aaa</a> </li> <li> <a class="863" href="detail.php?id=932">bbb</a> </li> <li> <a class="859 860 863 865 870" href="detail.php?id=931">ccc</a> </li> </ul>
It is necessary that when you click, for example, on "text3", all elements with the class "863" are added to the class "select".