How to include a JS-Library in the code?

Sorry about the silly question i asume the answer must be quite simple, but i don't get it, bit of confused...

I Installed JQuery and adapted the scope to my projet. Works fine, code hints and Help works.

But when i Test or deploy jquery is missing and it is not referenced in my source - html.

So my questions:

Do i have to include <script src="some lib" > manually in my files where i use a library? If yes, what path would i have to put there??
Do I have to put the lib-files manually in my project?

Thanks in advance Ingo

PS:

a) I use Intellij Idea, what should not do any difference to webstorm
b) I played around with project structure,global libraries and added jquery debug and release version but that didn't help me.btw. where is debug and release - version stored, i only see one project structure.
c)
d) I downloaded JQuery documentation ( online documentation previously worked fine ), but now documentation - xml is opened in xcode. ( mmmhhh)....

2 comments
Comment actions Permalink

Hi Ingo,

The best way to configure JQuery in your project is to place jquery.js source file inside your project near *.html files. Yes, you have to include

<script src="jquery.js"></script>


in html file.

For example:

<!DOCTYPE html>
<html>
<head>
    <script src="jquery-1.8.2.js"></script>
    <script>
        $(document).ready(function(){
            $("p").click(function(){
                $(this).hide();
            });
        });
    </script>
</head>

<body>
<p>If you click on me, I will disappear.</p>
</body>

</html>


See attached archive - jquery-sample.zip - extract it to a directory and just open the directory in WebStorm. If you open jquery-sample.html in a browser, it will work.
If you configured JQuery via "Settings | JavaScript | Libraries" dialog, clicked there "Download" and after chose JQuery then JQuery source file was stored in internal IDE directory and it isn't a good idea to reference it in *.html.


Attachment(s):
jquery-sample.zip
0
Comment actions Permalink

Yes, thank you!

Now i got it.

I didn't realise that installing a javascript lib is only for the code hinting and has no further effect on the code. i suspected something like an automatic including of the lib-reference when i start using library features within my code. But its ok.

0

Please sign in to leave a comment.