HTML
<nav>
<ul>
<li><a class="notDrop" href="#home">HOME</a></li>
<li><a class="notDrop" href="guides.html">GUIDES</a></li>
<li class="dropdown">
<a class="dropbtn">BRANDS</a>
<div class="dropdown-content">
<a href="gaming.html">NVIDIA</a>
<a href="#">INTEL</a>
<a href="#">CORSAIR</a>
<a href="#">SAMSUNG</a>
<li class="dropdown">
<a class="dropbtn">BUILDS</a>
<div class="dropdown-content">
<a href="gaming.html">GAMING</a>
<a href="#">OFFICE</a>
<a href="#">SERVER</a>
<a href="#">MEDIACENTER</a>
</div>
</li>
</ul>
</nav>
CSS
nav {
background-color: white;
overflow: hidden;
display: flex;
justify-content: center;
}
Javascript
window.onload = function mobile(){
if( isMobile.any() ) {
document.getElementById('nav').style.backgroundColor = "blue";
alert('Mobile');
}
}
But I can't get it to change color, what am I doing wrong? I managed to change the color of the body but I cant of the nav.