how to use same navbar on each page Javascript code example

Example 1: navigation bar on more than one page

<!-- add in head: --> <script src="https://code.jquery.com/jquery-1.10.2.js"></script>

<!--Navigation bar-->
<div id="nav-placeholder">

</div>

<script>
$(function(){
  $("#nav-placeholder").load("nav.html");
});
</script>
<!--end of Navigation bar-->

Example 2: navbar multiple pages

<script src="//code.jquery.com/jquery.min.js"></script>
<script>
$.get("navigation.html", function(data){
    $("#nav-placeholder").replaceWith(data);
});
</script>

Tags:

Misc Example