jakeinbake jakeinbake - 11 months ago 59
jQuery Question

slideToggle not expanding element

I'm using slideToggle() to expand elements in a panel. Upon clicking, the function does not expand said elements.

Here's the code:


<div class="panel panel-default">
<div class="panel-heading">
<h6 class="panel-title" style="text-align: center;"><a href='#' class="accordion-toggle">Risks</a></h6>
<div class="accordion-content" id="risks" style="height: 0;overflow: hidden;">
<div class="panel-body" style="text-align: center; font-size: 18px;">5.8%</div>


(document).ready(function($) {

//Expand or collapse this panel

//Hide the other panels


Answer Source

What I did is, going two layers up and then look for the requested element in the siblings of the parent-parent-element.


I made a fiddle for you here: https://jsfiddle.net/aLedkzw6/1/

Made an edit. Here you go.