Can I use link to add a jquery script into my html file?

  Kiến thức lập trình

I have a html file that has the following jquery script in the head section.
I want to add to many html files without having to copy the whole thing into the head section.
Can I use link to do that?
Thanks in advance.

<script
    src="https://code.jquery.com/jquery-3.3.1.js"
    integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
    crossorigin="anonymous">
</script>
<script> 
    $(function(){
  $("#footer").load("../footer.html");  
    });
</script> 

I tried using this, but it didn’t work.

<link rel="stylesheet" type="text/css" href="../jquery-script.txt">

New contributor

Ddaved is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

LEAVE A COMMENT