I found a code snippet on that I used to create an FAQ panel in HTML. However, the issue is that the code is set up with an ID, so I can only use it once. I actually want to be able to use it multiple times for different sections of my website.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$(".flip").click(function(){
$(this).next(".panel").slideToggle("slow");
});
});
</script>
<style type="text/css">
.panel,.flip
{
padding:5px;
text-align:center;
background-color:#e5eecc;
border:solid 1px #c3c3c3;
}
.panel
{
padding:50px;
display:none;
}
</style>
</head>
<body>
<div class="flip">Click to slide the panel down or up</div>
<div class="panel">Hello world!</div>
</body>
</html>