I wanted to make project Code your own adventure. So I choose a WebStorm program as a textredactor. But when I wrote
my jQuery code, it did not do anything. It seems like jQuery is not activeted or not connected to WebStorm or something like that. If you now how to fix it please help!!! Thanks
What do you have for External Libraries? We cannot see that folder’s contents. Also, what do you have for HTML and how is the document being initialized?
Have you inspected the document for console errors? What do you get as a response when you enter the following in the console command line?
typeof jQuery
thank you for your answer!
I think everything OK with initialization, because when I wrote “alert()” command in main.js it was working. But after I changed this code “alert()” to simple jQuery code, it didn’t work.
how to call console command line??
It doesn’t look like jQuery is loaded since their is no script load element.
The two lines you have in the body should be in the head.
<head>
<meta ...
<title>My Game Title</title>
<link ..
<script ...
</head>
<body>
<div></div>
</body>
The thing to do would be insert two script tags before your local ‘main.js’ script tag, but after the ‘link’ to the CSS.
<link ... css
<script ... jQuery core
<script ... jQuery UI
<script ... main.js
in the above order.
I’m not really keen on very long resource names or deep folders. Even locally we should try to construct a site that closely resembles a live web site. Make copies of the two jQuery files and save them in a simple folder, like ‘shared’, or directly in the ‘js’ folder (use lowercase folder names for web) with simple names, like jquery.js
and jquery-ui.js
. That way your script src attribute will be easy to write and read.