Tijl Declerck
Tijl Declerck

Reputation: 105

Adding jQuery library to WebStorm

I recently started using WebStorm and I wanted to use jQuery inside of it. Now I followed like the general guidelines on the internet to install the library but it still doesn't recognize the $ symbol when I use it.

What should I do?

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Upvotes: 0

Views: 2247

Answers (3)

PeterSun
PeterSun

Reputation: 1

  1. Add a reference to jquery on your html page.

  2. Use "Download library" command from context menu. I found it at "src" attribute of "script" tag.

  • Allow Webstorm to download the library via npm.
  1. Now you see an entry for jquery in the Project view below the folder "External Libraries".

Upvotes: 0

Tijl Declerck
Tijl Declerck

Reputation: 105

Haha, I found it. I changed my jquery code to a local file and simply didn't know it needed a .js at the end. Now it works. This drove me insane for two hours hahaha. Thanks for helping.

Upvotes: 0

iquellis
iquellis

Reputation: 1053

Download a copy of the JavaScript files on your file system and include it as external lib to your project (even if you use CDN versions of the libs with your project). Then WebStorm/PhpStorm/IntelliJ etc. can analyse the code (works with the .min-versions as well) and offers code completion etc.

Even more simple example with PhpStorm: Simple example with PhpStorm (comparable to WebStorm)

A cleaner method is to add it as external library, if you do not want to have a copy of jQuery in sources. However, I do not know, if WebStorm has a comparable option like that, as it has less functionality than PhpStorm or even IntelliJ.

Using external libraries in PhpStorm

Upvotes: 2

Related Questions