1

Question about creating an external javascript file and get his id to put inside div tag.

I ve tried copy the javascript code to an external file but then when I excute the div code it doesnt work

 <script src="h&f.js" defer </script>
<div id="header"></div>
<div id="footer"></div>
src="https://code.jquery.com/jquery-3.3.1.js"
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous"

$(function(){
    $("#header").load("header.html");
    $("#footer").load("footer.html");
});

Update: defer method didnt work The div tags dont work

Ventura
  • 97
  • 12

0 Answers0