daniel bobsen daniel bobsen - 11 months ago 57
HTML Question

Display none on label with javascript

Hi i looked on stackoverflow to correct my error but could not find any answers that helped, so i want my label to get display none when i click on the label and i want display block on an ul element, the ul element get's the display block but the label does not here's my code:

<script type="text/javascript">
var menuCheck = document.getElementById(checkBox);
var menuDims = document.getElementById(menuUl);
var labelUl = document.getElementById(labelUl);

function menuFunction() {

menuDims.style.display = "block";
labelUl.style.display = "none";


<nav class="menu">
<checkbox id="checkBox"></checkbox>
<label for="checkbox" onclick="menuFunction()" id="labelUl">l</label>
<ul id="menuUl">
<li><a href="index.html">Forside</a></li>
<li><a href="spil.html">Spil</a></li>
<li><a href="an.html">Anmeldelser</a></li>
<li><a href="#">Kontakt</a></li>


to fix:

var menuCheck = document.getElementById('checkBox');
var menuDims = document.getElementById('menuUl');
var labelUl = document.getElementById('labelUl');