I'm trying to activate my delete button in html with the help of JS. My button code looks like this
var panel = document.getElementByClassName("btn");
panel.addEventListener("click",hide);
function hide(){
var panelHide = document.getElementByClassName("mypanel");
panelHide.className = "hide";
}
<div class="mypanel">
<div class="header">My header</div>
<div class="body">
<p>body</p>
<div class="showOnHover">
<a href="" class="btn btn-xs btn-danger">delete</a>
</div>
</div>
</div>
and when I run the js it doesn't work, and I've already write something like .hide{display:none} in my CSS file. I would be so thankful if someone could answer this question, thanks