I found this interesting topic on reusing the navbar for multiple pages, and it works. The issue is when I add tags to my document like an h1 tag it does not show up.
Here is the code that loads the Navbar
<script>
$(function(){
$("#nav-placeholder").load("nav.html");
});
</script>
Here is the index.html code
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<!-- Nav loading starts -->
<div id="nav-placeholder"></div>
<!-- Nav loading ends -->
<!-- Home/index page content starts -->
<h1> This is the home page</h1>
<!-- Home/index page content ends -->
<script>
$.get("nav.html", function(data){
$("#nav-placeholder").replaceWith(data);
});
</script>
</body>
</html>
Here is the link to the original answer: How can I reuse a navigation bar on multiple pages?
Here is the Nav.html code
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@500&display=swap" rel="stylesheet" type="text/css">
<link rel="stylesheet" type='text/css' href="nav.css">
</head>
<body>
<div id="nav-bar">
<nav>
<input id="nav-toggle" type="checkbox">
<div class="logo"><strong>BuddyUp</strong></div>
<ul class="links">
<li><a href="index.html">Home</a></li>
<li><a href="#">About us</a></li>
<li><a href="#">Tips</a></li>
<li><a class="register" href="Login.html">Log in</a></li>
</ul>
<label for="nav-toggle" class="icon-burger">
<div class="line"></div>
<div class="line"></div>
<div class="line"></div>
</label>
</nav>
</div>
</body>
</html>
Thanks
Update:
If I refresh the index page I can see it for a brief moment