data toggle code example
Example 1: on button click show collapse div jquery
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="button">Toggle Expand/Collapse</button>
<div id="wrapper">
<ul id="list">
<li>Item</li>
<li>Item</li>
<li>Item</li>
<li>Item</li>
</ul>
</div>
Example 2: on button click show collapse div jquery
$(function() {
var b = $("#button");
var w = $("#wrapper");
var l = $("#list");
b.click(function() {
w.toggleClass('open');
});
});
Example 3: on button click show collapse div jquery
#wrapper {
background: #ccc;
overflow: hidden;
transition: max-height 300ms;
max-height: 0;
}
#wrapper.open {
max-height: 100px;
}