My goal is to create collapsible widgets within a side panel on my webpage. Overall, the functionality works smoothly. I am able to adjust the height of child divs to 0px with a transition, causing them to disappear.
However, I have run into an issue where a textarea does not collapse entirely. Even when I set the height of the textarea to 0px, it appears to still take up more space than expected.
The structure of the HTML code is as follows:
<div class="container">
<div class="heading" onclick="toggleSiblings(this)">heading</div>
<textarea class="collapsible" placeholder="type in here..."></textarea>
</div>
<div class="container">
<div class="heading" onclick="toggleSiblings(this)">heading</div>
<div class="collapsible"></div>
</div>
The function toggleSibblings() loops through all the siblings with a class of "collapsible" and toggles the "collapsed" class on them, which sets the height to 0px.
I have provided a jsfiddle link to demonstrate the issue: http://jsfiddle.net/447n50cy/
If anyone could help me understand why the textarea is taking up extra space, I would greatly appreciate it.