Answers for "on button click show collapse div jquery"

0

on button click show collapse div jquery

$(function() {
  var b = $("#button");
  var w = $("#wrapper");
  var l = $("#list");
  b.click(function() {
    w.toggleClass('open'); /* <-- toggle the application of the open class on click */
  });
});
Posted by: Guest on September-21-2020
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>
Posted by: Guest on September-21-2020
0

on button click show collapse div jquery

#wrapper {
  background: #ccc;
  overflow: hidden;
  transition: max-height 300ms;
  max-height: 0; /* <---hide by default */
}
#wrapper.open {
  max-height: 100px; /* <---when open, allow content to expand to take up as much height as it needs, up to e.g. 100px */
}
Posted by: Guest on September-21-2020

Code answers related to "on button click show collapse div jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language