Can you please tell me how to make a falling block like an accordion. I'm trying to integrate this script:

`var acc = document.getElementsByClassName("workplace_td icon pointer"); var i; for (i = 0; i < acc.length; i++) { acc[i].addEventListener("click", function() { this.classList.toggle("active"); var panel = this.nextElementSibling; if (panel.style.display === "block") { panel.style.display = "none"; } else { panel.style.display = "block"; } }); } ` 

But I can’t get him to open the link. Here, in theory, the script should be executed, but I’m not going to know how to do it:

  <div class="td_6"> <div class="workplace_td icon pointer"> <a href="#"></a> </div> </div> 

    1 answer 1

    So you have neither display:none , nor display:block by which the condition is checked.

     <div class="td_6"> <div class="workplace_td icon pointer"> <a href="#">Title</a> </div> <div style="display:block;"> Content </div> </div>