Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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 */
  });
});
Comment

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 */
}
Comment

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>
Comment

PREVIOUS NEXT
Code Example
Javascript :: dom event 
Javascript :: javascript list class properties 
Javascript :: full month name using moment 
Javascript :: function to generate random number in javascript 
Javascript :: How to loop through an object in JavaScript with the Object.values() method 
Javascript :: jscrollpane set background color 
Javascript :: js check if image url exists 
Javascript :: AngularJS how to use btn-group or radio group in list 
Javascript :: how to get the difference between two arrays in javascript 
Javascript :: how to append object in array javascript 
Javascript :: button disappears after click javascript 
Javascript :: javascript parseint 
Javascript :: multipart/form-data ajax jquery 
Javascript :: trim string in javascript 
Javascript :: convert js date to utc 
Javascript :: javascript date validation less than today 
Javascript :: how to use json stringify in javascript 
Javascript :: javasciprt set cookie 
Javascript :: javascript change _ to space 
Javascript :: how to find last element of an array 
Javascript :: express and node 
Javascript :: use $axios in vuex in nuxt 
Javascript :: how to concatenate in javscript 
Javascript :: javascript abstract class 
Javascript :: import npm dotenv package 
Javascript :: javascript training 
Javascript :: tobe a number jest 
Javascript :: Promises ex. 
Javascript :: jquery a tag click 
Javascript :: how to get value inside span using javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =