This forum is now read-only. Please use our new forums! Go to forums
How to run jquery on local machine
I’m trying to move all this code to my local machine, but I cannot get the script.js to run. I put the HTML, CSS, and JS in the same folder, and it looks like the HTML page is recognizing the css but not the js, for one reason or another. When I open the html doc with a browser, I do see the well-formed pull down, but when I click it, I can’t get the javascript to kick in… what am I doing wrong?
Answer 51227b697cab3a5a4c00174b
So i figured this out. You have to tell the webpage that you want to use jQuery and where it should get it. You can either put the latest jQuery file in on your server or link to it. Here is how i did it:
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="script.js"></script>
I simply downloaded jQuery from http://jquery.com/download/ Simply edit this so your path to the file is correct, and it should work :) Mine did!
It also works directly from the web by putting the link, like so:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="script.js"></script>
Hope it helps.
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
3 comments
Ah this is it. I included the link to the jquery website in my html file and everything works fine. I erroneously assumed that jquery was a standard part of the js package.
Thank you!
very helpful….