dynamic collapsible section in javascript

How to Create a Dynamic Collapsible Section in Javascript

Collapsible sections are very useful in hiding content and showing it only on demand. Few times its is required to make the collapsible section dynamic and sometimes it’s challenging. Here is the code I wrote in Perl and Javascript that creates a dynamic collapsible section. Demo: https://jsfiddle.net/yLw54jh2/