elixenide
elixenide

Reputation: 44833

Method expression is not of Function type

I have the following JavaScript file:

/*global $ */

function foo() {
    'use strict';
    var $tr = $('table tr'),
        $td = $tr.children('td');

    $td.html('Hello World');
}

In PHPStorm, children gets underlined with a weak warning. Mousing over it reveals this message:

Method expression is not of Function type

This file is in the same directory as jquery.min.js (v. 1.11.0, if that matters).

How can I fix this?

Note that the above example is a minimalist example sufficient to reproduce the problem; it's not my actual code, but it will product the same result.

Upvotes: 25

Views: 48855

Answers (3)

Henry Nana Adu
Henry Nana Adu

Reputation: 5

This is usually associated with phpstorm so either download and use the Jquery uncompressed version or use Jquery with CDN, it will be resolved.

Upvotes: -3

JochenJung
JochenJung

Reputation: 7213

Another solution would be to add jQuery as a library here:

Settings/Preferences dialog, click JavaScript under Languages and Frameworks, then click Libraries.

Upvotes: 1

elixenide
elixenide

Reputation: 44833

I have my answer thanks to Arun P Johny. I needed to have jquery-1.11.1.js (the uncompressed version) somewhere in my project. I added it, and PHPStorm immediately resolved all jQuery-related warnings.

Upvotes: 17

Related Questions