H
H
Happymalina2016-03-15 10:27:25
JavaScript
Happymalina, 2016-03-15 10:27:25

How to substitute the selected category in the list title from the drop-down menu?

Hey!! I really need help, how to implement such a menu as in Yandex Metrica - buttons, filters, and especially a drop-down menu with a choice of a filter category - so that when you click on a drop-down menu item, the name goes into the drop-down list header? Not strong in JS, maybe there are some plugins, in a casual conversation, a colleague said what is done through JSON ?? Is there any way to ease the pain? Tell me please.
8dded3e8e21142baaa8cf7d8ee91e3c9.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wheelie, 2016-03-15
@Happymalina

<a href="#" class="detailBy">Детализация: <span>по трафику</span></a>
<ul class="sm">
<li>по трафику</li>
<li>по кошкам</li>
<li>по рафику</li>
<ul>

$('.sm li').on('click', function(){
    var value = $(this).text();
   $('.detailBy span').text(value);
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question