Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phpstorm unresolved function or method $()

Tags:

phpstorm

I have the following problem: phpstorm do not recognize jquery methods and here and there I see

enter image description here

Unresolved function or method $()

This was bugging me for sometime but finally I tried to get rid of it with File->Settings->JavaScript->Libraries and adding jquery as a global / project.

My library setup looks like this:enter image description here

But is has not changed anything. I still see those pesky notices. Does anyone know how to get rid of them?

like image 552
Salvador Dali Avatar asked Feb 06 '14 23:02

Salvador Dali


3 Answers

There is a really stupid workaround,

Download the Library (in this case jQuery) from inside the IDE itself.

  • Open up settings (Ctrl + Alt + S on Linux)
  • Navigate to Languages & Frameworks -> Javascript -> Libraries
  • Click Download and choose jQuery

Hopefully the errors will vanish

Cheers

EDIT: After running the IDE through Fiddler, I realised this only solves the problem because of the version the IDE downloads.

So, the correct workaround is to Add older, non-AMD jQuery versions as a Global scoped Library and add the latest one as a Project scope library.

The latest non-AMD versions are:

1.10.2 for 1.x series. And, 2.0.0 for 2.x series.

like image 188
trve.fa7ad Avatar answered Oct 29 '22 19:10

trve.fa7ad


I had the same issue with version 1.11.2, and resolved it simply by adding the uncompressed version into my js folder.

like image 12
Bitwise Creative Avatar answered Oct 29 '22 18:10

Bitwise Creative


Just copy the uncompressed version of jQuery into your project folder. you don't even need to import it into your project, just copy it to javascript folder.

like image 6
Mostafa Mohammadzadeh Avatar answered Oct 29 '22 17:10

Mostafa Mohammadzadeh