I want to use this code to let the edit and the delete button appear after clicking the ... button, but when I do this it apply at all three of them and not the at the one i clicked
So, I want someone to tell me what should i change in the jquery code to only apply it to the one that i clicked not all of them
The Code :-
HTML :
<div class="commentdropdown pr-3">
<button class="dropbtn btn p-0 m-0 bg-white">...</button>
<div class="dropdown-content">
<a href="#">Edit</a>
<a href="#">Delete</a>
</div>
<button class="dropbtn btn p-0 m-0 bg-white">...</button>
<div class="dropdown-content">
<a href="#">Edit</a>
<a href="#">Delete</a>
</div>
<button class="dropbtn btn p-0 m-0 bg-white">...</button>
<div class="dropdown-content">
<a href="#">Edit</a>
<a href="#">Delete</a>
</div>
</div>
CSS :
.commentdropdown{
float: right;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
}
.apear{
display: block;
}
.commentbtn{
width: 30vw;
}
JavaScript :
$(".commentdropdown").on("click", function(){
$(".dropdown-content").toggleClass("apear");
});
Thanks