Linking to a Local Master jQuery Folder


#1


Hey,

I'm trying out a bunch of lessons/projects from scratch locally and I want to make a jQuery file that all my projects link to, rather than copying the file to each new project folder. Is this something that's fine to do? The jQuery file would be in a master folder beside project folders like so:

What would my <script href=""> have in between the quotes? Normally it would be just the file name if it was in the same folder.


```


Web_Projects Folder:
   Project1 Folder:
      Images Folder
      index.html
      style.css
      script.js
   Project2 Folder:
      Images Folder
      index.html
      style.css
      script.js
   Master jQuery Folder:
      jquery-3.2.1.js


#2

You need to include the file location. In this case it would be somethings like this.

<script href="WebProjectsFolder/MasterjQueryFolder/jquery-3.2.1.js">


#3

Unfortunately it's not working still. I changed href to src since I think that's the right thing to put? But still not getting a connection.

This is how my html doc is searching for it. Do I need to go further back? My test site folder that I'm working out of is within Web-Projects. Going far enough back it's C:\Users\Me\Desktop\Web-Projects...

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="style.css"/>
    <script src="Web-Projects/MASTER_jQuery/jquery-3.2.1.js"></script>
    <script src="script.js"></script>
</head>
<body>
    <div id="header"></div>
    <div id="primary-section"></div>
</body>
</html>

I'm trying to simply remove a div on click as a test using this code in style.css and script.js

CSS

#header {
    border: 1px solid black;
    height: 100px;
    background-color: blue;
}

JS

$(document).ready(function(){
    $("#header").click(function(){
        $(this).hide();
    });
});

#4

There's a post on Stack Overflow that suggests having something like ../MASTER_jQuery/jquery-3.2.1.js which is interesting. Using Brackets it seems to recognize what I'm trying to do now. Unfortunately, I'm still not getting a hide response from jQuery.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.