In my project, I have a div, which is set to display: none;
by default. When a user clicks an image, I use the onclick function to attempt to display the image. However this method does not work for some reason.
Here is my HTML:
<img onclick="hamburgerFunc()" class="hamburger-btn" width="38px" src="{% static 'hamburgericon.png' %}" alt="Image of hamburger icon">
<div class="box arrow-top"></div>
<script src="{% static 'home.js' %}"></script>
JS:
function hamburgerFunc(objs) {
objs = document.getElementsByClassName("box arrow-top")
objs.style.display = 'inline-block';
}
UPDATED CODE:
.box.arrow-top:after {
content: " ";
position: absolute;
right: 30px;
top: -15px;
border-top: none;
display: none;
border-right: 15px solid transparent;
border-left: 15px solid transparent;
border-bottom: 15px solid white;
}
The box arrow-top is the div I want to display once the image is pressed. Does anybody know why this code is not working? Thank you.