Currently, I am experimenting with Jquery slideToggle using the tutorial found on the W3Schools website. I am interested in changing the + icon to a - icon when the Panel
div is expanded. Can anyone provide me with guidance on the correct approach?
I am inspired by the functionality seen on this website:
$(document).ready(function(){
$(".flip").click(function(){
$(".panel").slideToggle("normal");
$(".flip").toggleClass('fa-plus-circle fa-minus-circle')
});
});
.panel, .flip {
padding: 2px;
text-align: center;
}
.flip:after {
content: '\002B';
color: #777;
font-weight: bold;
margin-left: 5px;
}
.panel {
padding: 10px;
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="panel">I am hidden.</div>
<div class="flip"></div>