php 如何在 NetBeans 中完成 jQuery 代码?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1604557/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:14:44  来源:igfitidea点击:

How can I get jQuery code completion in NetBeans?

phpjquerynetbeans

提问by Edward Tanguay

I'm using NetBeans for PHP.

我正在将NetBeans 用于 PHP

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

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

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

我怎样才能让它也给我 jQuery 代码完成?

alt text

替代文字

采纳答案by ufk

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 能够解析它并正确添加代码完成。

回答by dvdrtrgn

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.jsor http://www.asp.net/ajaxlibrary/cdn.ashxfor version after 1.4.1

修改:VSdocs 实际工作:http://code.jquery.com/jquery-1.4.1-vsdoc.js 或http://www.asp.net/ajaxlibrary/cdn.ashx1.4.1 之后的版本

回答by Funky Dude

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

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

回答by Webpavilion

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 6.x 上进行开发。将非缩小版本的 jquery-1.2.6.js 文件添加到项目的根文件夹后,自动完成工作(因此它适用于任何版本)。

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

指定文件名的版本很重要,没有-1.2.6 是不行的!

回答by nzpcmad

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 或更高版本”。否则,您将在代码完成弹出窗口中收到“不支持”错误,并且许多命令将被删除。

回答by SZ Quadri

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-1.xyjs 放在您的项目中的某个位置(NetBeans 可以在它到达您的 js 文件时访问它),您应该很高兴。

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

要进行测试,您可以将 jQuery 文件与正在编辑的 js 文件放在同一文件夹中。

回答by pepkin88

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 文档。