admin管理员组

文章数量:1431904

I just started using netbeans (NetBeans IDE 7.2 (Build 201207171143) under Win7/64bit) to try out jQuery developement. Especially the autopletion seemed very handy..

I used this tutorial: .html I did everything like in this tutorial but took the current version of jQuery.js (v1.8.0) instead of the older 1.4.2-revision.

Lets look at the following code snipped:

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

The autopletion works for "$(document)." and suggests "ready". So far, so good...

The 3rd line starts with "$("h1")." after that selector followed by "." I get a lot of suggestions but not for "click"; When I use the older jQuery-1.4.2.js it works as seen in the following screenshot of the tutorial: .png

Questions:

  • What's actually the problem here?
  • Can we somehow get this working with the current version of jQuery? If so: How?
  • Who's potentially in charge here ... bug in jQuery or netbeans?

Regards, Stefan

--- update ---

The problem only occurs if you add a <script type="text/javascript" src="js/jquery.js"></script> to the source code. If you omit the include, it's working as it should. So this seems to be an issue of Netbeans. And lead us to the following adapted question:

Question: Not including the jquery.js is just a workaround. Is there a way to fix that? Maybe it's needed that we disable some "auto-include-everything" option somewhere in the project?

--- update #2 : SOLUTION ---

It's even the name of the included script <script type="text/javascript" src="jq.js"></script> works, but any resource name ending in 'jquery.js' don't work, whereas <script type="text/javascript" src="jquery-1.8.0.js"></script> worked! So it's actually a kind of bug in Netbeans, that is caused by some hardcoded stuff. And the solution is to rename the JavaScript file in a way that it e.g. still includes the revision.

I just started using netbeans (NetBeans IDE 7.2 (Build 201207171143) under Win7/64bit) to try out jQuery developement. Especially the autopletion seemed very handy..

I used this tutorial: http://netbeans/kb/docs/web/js-toolkits-jquery.html I did everything like in this tutorial but took the current version of jQuery.js (v1.8.0) instead of the older 1.4.2-revision.

Lets look at the following code snipped:

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

The autopletion works for "$(document)." and suggests "ready". So far, so good...

The 3rd line starts with "$("h1")." after that selector followed by "." I get a lot of suggestions but not for "click"; When I use the older jQuery-1.4.2.js it works as seen in the following screenshot of the tutorial: http://netbeans/images_www/articles/69/web/js-toolkits-jquery/code-pletion.png

Questions:

  • What's actually the problem here?
  • Can we somehow get this working with the current version of jQuery? If so: How?
  • Who's potentially in charge here ... bug in jQuery or netbeans?

Regards, Stefan

--- update ---

The problem only occurs if you add a <script type="text/javascript" src="js/jquery.js"></script> to the source code. If you omit the include, it's working as it should. So this seems to be an issue of Netbeans. And lead us to the following adapted question:

Question: Not including the jquery.js is just a workaround. Is there a way to fix that? Maybe it's needed that we disable some "auto-include-everything" option somewhere in the project?

--- update #2 : SOLUTION ---

It's even the name of the included script <script type="text/javascript" src="jq.js"></script> works, but any resource name ending in 'jquery.js' don't work, whereas <script type="text/javascript" src="jquery-1.8.0.js"></script> worked! So it's actually a kind of bug in Netbeans, that is caused by some hardcoded stuff. And the solution is to rename the JavaScript file in a way that it e.g. still includes the revision.

Share Improve this question edited Aug 18, 2012 at 23:41 SDwarfs asked Aug 14, 2012 at 15:50 SDwarfsSDwarfs 3,2395 gold badges33 silver badges54 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5 +50

Looks like you're using a minified version of jQuery, because you're likely getting code pletition from JS core, so you need to include in your project the development version or both (development and minified), if you're pushing code to production, to get jQuery code pletition and API especifications. Watch this:

One possible problem might be that click() has been depreciated in favor of on() Of course click() without parameters is still used to fire the event, so I'm probably wrong but see if this autopletes correctly:

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

Note: on() was introduced in version 1.7

本文标签: javascriptNetbeans autocompletion not fully working with current jQueryjs (v180)Stack Overflow