Function is not defined??
I am getting an error "Uncaught ReferenceError: togglemenu is not defined at HTMLButtonElement.onclick"
In the <body> section of my page, I have this code:
Anyone know why my code can't find it's a$s with both hands and a map?
Thanks.
<button onclick="togglemenu()" style="width: 60px; height: 60px;"><img src="images/Menu-Icon.jpg" width="40" height="40">Menu</button>
<script type="text/javascript">
function togglemenu(){
var x = document.getElementById("collapsemenu");
if (x.style.display = "none") {x.style.display = "block";}
Else {x.style.display = "none";}
}
</script>
<Div class="collapsemenu" visibility: none;>
<a href="index.html">Home</a>
<a href="#about">About</a>
<a href="#services">Services</a>
<a href="contact.html">Contact</a>
</div>
Posted Dec 6, 2018, 12:58 AM UTC
012