How can I get jQuery code completion in NetBeans?

All we need is an easy explanation of the problem, so here it is.

I’m using NetBeans for PHP.

When I edit a .js file, it gives me javascript code completion.

How can I get it to also give me jQuery code completion?

alt text

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

First go to Tools -> Options -> Miscellaneous and click on the Javascript tab,
make sure the targeted browsers are configured properly, code completion changes by the minimal version of the targeted browsers to make sure that the functionality is supported.

You also need to add the jquery js file to your project so netbeans would be able to parse it and to properly add code completion.

Method 2

These answers are misleading because jQuery no longer self-documents using “scriptdoc.” Version 1.1.4 was the last to have this. Anything newer than that (>=1.2 ~mid-2007) is gutted.

amending that: VSdocs actually work:
http://code.jquery.com/jquery-1.4.1-vsdoc.js
or http://www.asp.net/ajaxlibrary/cdn.ashx for version after 1.4.1

Method 3

i suspect using a non-minified version of jquery would help.

Method 4

For Netbeans 6.7 / 6.8 / 6.9, just follow the guide here:

Using jQuery to Enhance the Appearance and Usability of a Web Page

There’s a section about half way down called “NetBeans Code Completion and API Support”.

Worked no problem for me.

Note: “Choose the uncompressed version, i.e., ‘Development’, before downloading the jQuery library. Using the uncompressed version will allow you to examine the JavaScript code in the editor, and aid in any debugging processes.”

Tip: Tools / Options / Miscellaneous / JavaScript. In the “Targeted Browsers” section, ensure IE is “6 or later”. Otherwise, you’ll get “Not supported” errors in the code completion pop-up and a lot of the commands will be struck out.

Method 5

I use netbians 7.x for development on drupal 6.x. Autocomplete works after adding non-minified version jquery-1.2.6.js file to the root folder of the project (so it will be with any version).

It is important to specify the version of the file name, without -1.2.6 will not work!

Method 6

The basic rule is that your jQuery (or for that matter any js lib) should be found in the same project you need auto complete to work. So just place jquery-1.x.y.js somewhere in your project (that can be reached by NetBeans as it reaches your js file) and you should be good to go.

To test you can put the jQuery file in the same folder as your js file being edited.

Method 7

Make sure your Internet connection is working, because NetBeans downloads documentation when is needed. I think that NetBeans downloads it from there, but this is only my assumption. This is parsing friendly XML document with whole and recent jQuery documentation.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply