Javascript function not loading

In my replit I am trying to make a function to change the opacity of the navbar when the body loads. I have checked the javascript and HTML multiple times but the devtools says the function is not defined

Relevant HTML

<body onload="setNavbarOpacity()">
   
    <nav>
  <ul id="Navbar">
  <li><button id="Contact"><a href="Contact.html">Contact Us</a></button></li>
    <li><a href=Prices.html class="link">Prices</a></li>
    <li><a href=Projects.html class="link">Project</a></li>
  </ul>
</nav>

I have have the Javascript linked btw

Relevant JS

function setNavbarOpacity() {
  let navbar = document.getElementById("Navbar");
  navbar.style.opacity = 1;
}
1 Like

Show your repl/entire thing.

1 Like

Is your HTML file linked to your supposed javascript file?

You can easily do that by adding something like this into your body:

<script src="main.js"></script>
2 Likes