0

So my header looks like this...

<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Deschutes Pine</title>
    <link rel="stylesheet" href="Crew.css">
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src = "/Script.js"></script>
    <link href='http://fonts.googleapis.com/css?family=Oxygen' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

And my Javascript looks like this:

    /*jslint browser: true*/
    /*global $, jQuery*/
    $(document).ready(function () {
        $('.faces').hide();
     });

Ive already tried posting the js in script tags and it ran smooth , so the problem is its finding the way to my js file. Script.js is in the same folder so it's not that.

1
  • is this running on a file server? Commented Aug 4, 2015 at 21:57

2 Answers 2

1

If they're both in the subfolder you'd want to drop the leading / before the script's name. The preceding / brings you to the document root. Read up on relative URI's to get a better understanding if this doesn't make sense.

Also for your JQuery include I'd suggest eliminating the http and just leave //code.jquery.com/jquery-1.9.1.min.js (or as I prefer //ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js). This will prevent errors when including from an https page without changing the URI to specify https.

Sign up to request clarification or add additional context in comments.

Comments

0
<script type="text/JavaScript" src="script.js"></SCRIPT>

use this one if you have your JS into any folder then you can use (/foldername/filename.js).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.