I am making a chrome extension and I want to add an overlay navigation, but I need Javascript for that, and when I put the Javascript in, chrome told me I cannot use inline JS.
So then I used an event listener, but then it told me that it cannot read the even listener.
The navigation's HTML:
<div id="Navigation" class="Overlay">
<a href="javascript:void(0)" id="closebtn">×</a>
<div class="Links">
<a href="popup.html"> Home </a>
<a href="colors.html"> Colors </a>
<a href="links.html"> Links </a>
</div>
</div>
<span id="menuIcon">
<div class="menuPart"></div>
<div class="menuPart"></div>
<div class="menuPart"></div>
</span>
The navigation's EventListener (the JS):
document.getElementById("menuIcon").addEventListener("click", function(){
document.getElementById("Navigation").style.width = "100%"
});
document.getElementById("closebtn").addEventListener("click", function(){
document.getElementById("Navigation").style.width = "0%"
});
I have no idea what I'm doing wrong. Please help me.