Hi @Benjoe,
You'd better provide your complete code or the problem you are currently facing.
I wrote a demo according to your needs, you can refer to it.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
#toggle-view .panel {
margin: 5px 0;
display: none;
}
</style>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<script>
$(document).ready(function () {
$('#toggle-view li').click(function () {
var text = $(this).find('div.panel');
if (text.is(':hidden')) {
text.slideDown('200');
$(this).find('span').removeClass("glyphicon glyphicon-plus glyph-plus-toggle").addClass("glyphicon glyphicon-minus glyph-minus-toggle");
} else {
text.slideUp('200');
$(this).find('span').removeClass("glyphicon glyphicon-minus glyph-minus-toggle").addClass("glyphicon glyphicon-plus glyph-plus-toggle");
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<h2 class="h2-finder">Used cars</h2>
<ul id="toggle-view">
<li class="li-toggle">
<h3 class="toggle-h3">Title 1<span class="glyphicon glyphicon-plus glyph-plus-toggle"></span></h3>
<div class="panel">
<span>qwertyuiopasdfghjklzxcvbnm</span>
</div>
</li>
</ul>
</form>
</body>
</html>
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.