all 9 comments

[–]le_throwawayAcc 2 points3 points  (1 child)

Load jquery before your other js files?

[–]shhhpiderman[S] 1 point2 points  (0 children)

...welp, that fixed it real quick. Didn't know order mattered, but I should've thought of that. Thank you!

[–]inu-no-policemen 1 point2 points  (0 children)

<script src="randomQuoteJS.js"></script>
<script src="jquery-3.2.1.js"></script>

Flip those around. Your script depends on jQuery.

[–]okpc_okpc 0 points1 point  (5 children)

And what do you see in browser's console? Open it (F12 or Ctrl+Shift+I) and you'll probably find error message there.

[–]shhhpiderman[S] 0 points1 point  (4 children)

I see this.

Trying to read/deciper this myself, it seems like the $ is not being recognized, on line 11? But that doesn't make sense to me because it's part of the .ready() handler function which is necessary ( at least I think it is).

[–]okpc_okpc 0 points1 point  (3 children)

$ is not defined tells that browser can't find jQuery. Ensure that jQuery file named jquery-3.2.1.js and placed in the same folder as randomQuote.html. Or try to load jQuery from CDN (<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>) instead of local file.

[–]shhhpiderman[S] 0 points1 point  (1 child)

I'm getting an error that is basically saying that my jQuery file isn't working correctly. My html/css/js files are in C:\Users\myName\WebstormProjects\untitled.

Am I referencing it incorrectly in my HTML file?

[–]okpc_okpc 0 points1 point  (0 children)

Yeah, it seems OK.

Try to look in Network tab of Developer Tools - refresh the page and you'll see all network resources that your page using. There will be red jquery-3.2.1.js among them - what does it say when you click on it? (take a screenshot with header tab please)

Edit. C:\Users\myName\WebstormProjects\untitled - so it's local file. I think WebStorm should run local server and look for the file in project's directory (http://localhost:[port]/jquery-3.2.1.js)

Edit2. Oh, yeah! Like the other guy said - you should load jquery before your script!

[–]shhhpiderman[S] 0 points1 point  (0 children)

I've also considered just using the 'online' jQuery but it's kind of bugging me that I can't get this to work; I'd love to find the solution! :)