如何在NetBeans中完成jQuery代码?

时间:2022-07-23 15:08:52

I'm using NetBeans for PHP.

我在PHP中使用NetBeans。

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

当我编辑.js文件时,它会给我javascript代码完成。

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

如何让它同时完成jQuery代码?

alt text http://i34.tinypic.com/1hdmpt.png

alt文本http://i34.tinypic.com/1hdmpt.png

7 个解决方案

#1


21  

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.

首先切换到工具->选项->杂项并单击Javascript选项卡,确保目标浏览器的配置正确,代码完成由目标浏览器的最小版本更改,以确保支持功能。

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.

您还需要将jquery js文件添加到项目中,以便netbeans能够解析它并正确地添加代码完成。

#2


7  

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

我怀疑使用非缩小版的jquery可能会有所帮助。

#3


7  

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.

这些答案具有误导性,因为jQuery不再使用“scriptdoc”自定义文档。1.1.4版本是最后一个有此功能的版本。任何更新的(>=1.2 ~ 2007年年中)都将被销毁。

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

修改:VSdocs实际工作:http://code.jquery.com/jquery-1.4.1-vsdoc.js或http://www.asp.net/ajaxlibrary/cdn.ashx,版本为1.4.1。

#4


3  

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

对于Netbeans 6.7 / 6.8 / 6.9,请参考以下指南:

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

使用jQuery增强网页的外观和可用性。

There's a section about half way down called "NetBeans Code Completion and API Support".

有一个部分大约在一半以下,叫做“NetBeans代码完成和API支持”。

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."

注意:“选择未压缩版本,即,“开发”,然后下载jQuery库。使用未压缩版本将允许您检查编辑器中的JavaScript代码,并帮助进行任何调试过程。

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.

提示:工具/选项/杂项/ JavaScript。在“目标浏览器”部分,确保IE为“6或更高”。否则,您将在代码完成弹出框中得到“不受支持”的错误,并且将删除许多命令。

#5


3  

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).

我使用netbians 7。x用于drupal的开发。在添加了非小型化版本jquery-1.2.6之后,自动完成工作。js文件到项目的根文件夹(因此它将与任何版本一起)。

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

重要的是要指定文件名的版本,没有-1.2.6就不能工作!

#6


2  

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.

基本规则是,您的jQuery(或任何js库)应该在您需要自动完成的项目中找到。所以把jquery x.y——1.。项目中的某个位置(NetBeans到达您的js文件时可以访问它),您应该可以开始了。

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

为了测试,您可以将jQuery文件放在正在编辑的js文件的同一文件夹中。

#7


0  

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.

确保您的Internet连接正常工作,因为NetBeans在需要时下载文档。我认为NetBeans从那里下载它,但这只是我的假设。这是用完整的和最新的jQuery文档解析友好的XML文档。

#1


21  

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.

首先切换到工具->选项->杂项并单击Javascript选项卡,确保目标浏览器的配置正确,代码完成由目标浏览器的最小版本更改,以确保支持功能。

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.

您还需要将jquery js文件添加到项目中,以便netbeans能够解析它并正确地添加代码完成。

#2


7  

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

我怀疑使用非缩小版的jquery可能会有所帮助。

#3


7  

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.

这些答案具有误导性,因为jQuery不再使用“scriptdoc”自定义文档。1.1.4版本是最后一个有此功能的版本。任何更新的(>=1.2 ~ 2007年年中)都将被销毁。

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

修改:VSdocs实际工作:http://code.jquery.com/jquery-1.4.1-vsdoc.js或http://www.asp.net/ajaxlibrary/cdn.ashx,版本为1.4.1。

#4


3  

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

对于Netbeans 6.7 / 6.8 / 6.9,请参考以下指南:

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

使用jQuery增强网页的外观和可用性。

There's a section about half way down called "NetBeans Code Completion and API Support".

有一个部分大约在一半以下,叫做“NetBeans代码完成和API支持”。

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."

注意:“选择未压缩版本,即,“开发”,然后下载jQuery库。使用未压缩版本将允许您检查编辑器中的JavaScript代码,并帮助进行任何调试过程。

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.

提示:工具/选项/杂项/ JavaScript。在“目标浏览器”部分,确保IE为“6或更高”。否则,您将在代码完成弹出框中得到“不受支持”的错误,并且将删除许多命令。

#5


3  

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).

我使用netbians 7。x用于drupal的开发。在添加了非小型化版本jquery-1.2.6之后,自动完成工作。js文件到项目的根文件夹(因此它将与任何版本一起)。

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

重要的是要指定文件名的版本,没有-1.2.6就不能工作!

#6


2  

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.

基本规则是,您的jQuery(或任何js库)应该在您需要自动完成的项目中找到。所以把jquery x.y——1.。项目中的某个位置(NetBeans到达您的js文件时可以访问它),您应该可以开始了。

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

为了测试,您可以将jQuery文件放在正在编辑的js文件的同一文件夹中。

#7


0  

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.

确保您的Internet连接正常工作,因为NetBeans在需要时下载文档。我认为NetBeans从那里下载它,但这只是我的假设。这是用完整的和最新的jQuery文档解析友好的XML文档。