0
I need help with Jquery below... I need each <div id="flip"></div>
inside each <div id="conteudo"></div>
show the <div id="panel">Hello world!</div>
.
However, the way it is, it only works with the first div content... the second when you click nothing happens. someone can help me?
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#conteudo").each(function() {
$("#flip").click(function(){
$("#panel").slideToggle("slow");
});
});
});
</script>
<style>
#panel, #flip {
padding: 5px;
text-align: center;
background-color: #e5eecc;
border: solid 1px #c3c3c3;
}
#panel {
padding: 50px;
display: none;
}
</style>
</head>
<body>
<div id="conteudo">
<div id="flip">Click to slide the panel down or up</div>
<div id="panel">Hello world!</div>
</div>
<div id="conteudo">
<div id="flip">Click to slide the panel down or up</div>
<div id="panel">Hello world!</div>
</div>
</body>
</html>
Thanks!! I managed using the class!!
– maiconfriedel