$ is not defined

I have added the Jquery 2.0 and Jquery UI library through settings, and enabled them.


but when i try to do this:


the error output is

ReferenceError: $ is not defined
at Object.<anonymous> (c:\Users\adoan\WebstormProjects\untitled1\tesy.js:1:63)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3

any idea what is going on?
1 comment
Comment actions Permalink

From the error it seems that you are trying to execute .js file with jQuery code as a node.js application.. it's possible in principle (see http://stackoverflow.com/questions/21674080/how-to-use-npm-jquery-module, for example), but, of course, you need to make sure that the corresponding modules are installed and required in your code. But JQuery is mainly used in browser, for manipulating DOM. You need to create .HTML file that references jquery library and run it in browser using Run/Debug  in .html right-click menu.


Note: errors you get in runtime have ABSOLUTELY NOTHING to do with WebStorm Javascript libraries settings - the latter are only used by WebStorm itself to code completion/navigation/highlighting, they are not available to browser/Node.js when you run your code


Please sign in to leave a comment.