Netbeans autocomplete not fully working with current jQuery.js (v1.8.0)

I just started using netbeans (NetBeans IDE 7.2 (Build 201207171143) under Win7 / 64bit) to try jQuery developmentement. Especially autofill seemed very convenient.

I used this tutorial: http://netbeans.org/kb/docs/web/js-toolkits-jquery.html I did everything as in this tutorial, but took the current version of jQuery.js (v1.8.0) instead of the old version 1.4 .2.

Let's look at the following code:

<script type="text/javascript"> $(document).ready(function(){ $("h1").click(function(){ alert ("HI!"); }); }); </script> 

Autocomplete works for "$ (document)". and offers "done." So far so good ...

The third line starts with "$ (" h1 ")". after this selector followed by "." I get a lot of suggestions, but not for "click"; When I use the old jQuery-1.4.2.js, it works as shown in the following screenshot of the tutorial: http://netbeans.org/images_www/articles/69/web/js-toolkits-jquery/code-completion.png

Questions:

  • What really is the problem here?
  • Can we somehow work with the current version of jQuery? If yes: How?
  • Who is potentially responsible here ... bug in jQuery or netbeans?

Regards, Stefan

--- update ---

The problem only occurs when <script type="text/javascript" src="js/jquery.js"></script> is <script type="text/javascript" src="js/jquery.js"></script> to the source code. If you omit enable, it works as it should. So this is a Netbeans problem. And bring us to the following adapted question:

Question. Not including jquery.js - this is just a workaround. Is there any way to fix this? Maybe we need to disable the "auto-include-everything" option somewhere in the project?

--- Update # 2: SOLUTION ---

This is even the name of the included script <script type="text/javascript" src="jq.js"></script> works, but any resource name ending in 'jquery.js' does not work, while <script type="text/javascript" src="jquery-1.8.0.js"></script> works! So this is actually some kind of mistake in Netbeans caused by some hard-coded materials. And the solution is to rename the JavaScript file so that it, for example. still includes an audit.

+7
source share
2 answers

It looks like you are using the jQuery mini version because you are most likely getting code completion from the JS core, so you need to include the development version in your project, or both (development and minimization) if you are pushing the code to production getting jQuery code and API specifications. See this:

jQuery 1.18 code completition demostration

+5
source

One of the possible problems may be that click() depreciated in favor of on() Of course, click() without parameters is still used to trigger the event, so I'm probably wrong, but I see if this autocomplete is correct: / p >

 $("h1").on("click",function(){ alert ("HI!"); }); 

Note: on() was introduced in version 1.7

0
source

All Articles