Hung up the processor of a click on the button displaying, hiding the additional block with the list. Everything is working.
$('.button').on('click', function (event) { event.preventDefault(); var ul = $(this).next('.ul'); ul.toggle(); }); I decided to do it in such a way that the additional block would be hidden when clicking outside of it.
$(document).on('click', function (event) { var ul = $('.ul'); if (!ul.is(event.target) && ul.has(event.target).length === 0 && ul.is(':visible')) { ul.hide(); } }); After that the toggle stopped working. Already tried different combinations of code from various sites, but nothing helps. Tell me, please, where is the error.