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>$(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 */
});
});#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 */
}
Also in JavaScript:
- TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received undefined at validateString (internal/validators.js:120:11)
- javascript change select options dynamically
- package json scripts multiple commands
- javascript vererbung Klasse extends super constructor
- Schema Password Hashing COde
- node save wav base64
- jquery .not or
- jquery selected option
- checking a condition in object javascript
- js test if array
- jquery get value of radio input
- react native timed out waiting for modules to be invalidated
- let in javascript
- javascript keydown
- how to check version of node js in cmd
- odoo post template form using js
- js get element padding
- javascript loop through object values
- selectlist and javascript in VF page
- redirect user to another page javascript
- You need to inject a global window.jQuery first.
- export component in
- javascript detect touch screen
- array of array key value javascript