1
<head>
    <title>Mary</title>
    <link href="http://localhost/stylesheet.css" type="text/css" rel="stylesheet">
    <link href="http://localhost/mary/jquery-ui-1.10.3.custom.min.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js'></script>
    <script type="text/javascript" src="http://localhost/jscript.js"></script>
    <script type="text/javascript" src="http://localhost/jquery-ui-1.10.3.custom.min.js"/>
</head>

I just got done learning about jquery ui and am trying to include it in my very first webpage, but it's not working. I checked all of the links on my server, and they link up to the documentation, but the only way the content shows up when I check the webpage on my server is if I comment out the last script tag. But if I do that, I can't access the jquery ui, right? I'm so confused. I'm so excited to try all of this stuff out, but I can't figure out how to make it work :( Any help is greatly appreciated.

4
  • Are you running this on localhost or a remote server? Either way, I'd recommend using relative paths instead of hardcoding localhost. Commented Nov 8, 2013 at 22:02
  • What errors do you get in the console? Commented Nov 8, 2013 at 22:03
  • local host right now. I'm using a WAMP server. I got a raspberryPi for my birthday, but I don't have time to learn how to use it yet. Once I master this stuff, it's next. I don't really know how to use relative paths yet for a local server, so I figured I would just do what I know how to do first, but from what I understand, it's basically using a shortcut to a path already written above it, right? Commented Nov 8, 2013 at 22:08
  • I don't get any errors at all. I have divs that don't show up when I run it as is above, but they do show up when I comment out the last script tag. I don't have any idea what could cause something like that. Commented Nov 8, 2013 at 22:09

2 Answers 2

1

karthikr's answer is most likely the problem, but if that doesn't work try referencing the URL hosted by jquery itself.

<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for your advice. Is this considered a best practice?
Not usually. It's best to download the actual file to your server so there isn't extra loading time for the user to get the file from another server.
Thanks, Steve. That makes much more sense to me.
0

Assuming all the static files are properly referenced,

<script type="text/javascript" src="http://localhost/jquery-ui-1.10.3.custom.min.js"/>

should be

<script type="text/javascript" src="http://localhost/jquery-ui-1.10.3.custom.min.js"></script>

Note the end of the script tag /> should be ></script>

3 Comments

let me try that! Am I correct though in assuming that when I test it out by clicking the links they are working correctly if that takes me to the page that it's linked to or is that a poor assumption because I'm clicking on the link and there could be an error elsewhere in the script tag?
IT WORKED! I can't believe I missed that! thank you so so so much!
Yes.. that is a good way to test it. A smarter way would be to just see the browser's console to see if there are any console errors (404s)

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.