There are two groups of elements. Both groups have the same numbers in the class.
How to make that when you click on an element from the first group, an element is selected with the corresponding digit in the class from the second group?
I see it like this:
$('ul.one>li').click(function() { //var e=... $('li.a-click-' + e).addClass('active'); }); li.active { color: #fff; background: #4CAF50; padding: 0 15px; list-style: none; margin: 5px; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <ul class='one'> <li class='item click-1'>1</li> <li class='item click-2'>2</li> <li class='item click-3'>3</li> <li class='item click-4'>4</li> </ul> <ul class='two'> <li class='a-item-1'>1</li> <li class='a-item-2'>2</li> <li class='a-item-3'>3</li> <li class='a-item-4'>4</li> </ul> But how to make the variable take the figure - I can not imagine