M
M
maxwellw0w012020-05-05 12:34:15
JavaScript
maxwellw0w01, 2020-05-05 12:34:15

How to make it so that when you click on the dropdown arrow, the block collapses?

How to write code correctly so that when you click on " " , a specific block is collapsed, namely ? HTML written in script:<div class="list"></div><div class ="scroll"></div>

<div class="left__block__info">
   <li class="first_message"></li>
     <select class="list"></select>
        <div class="border"></div>
   <div class="scroll"><li class="second_message"></li></div>      
</div>

The action needs to be converted via delegation.
Part of the script, just written to perform this action:
function scrollComments (  scrollUp  )  {
    scrollUp.slideToggle( );
     };
    $('body') .on('click', 'select.list', function(  event  )  {
      event.preventDefault();
    let  scrollUp = $(this).parents('.scroll');
    scrollComments(scrollUp);
  });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valentin Birulya, 2020-05-05
@nykakdelishki

Through DOM traversal, can display:none; block
The first guide in the search
https://professorweb.ru/my/javascript/jquery/level...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question