在网上看到很多 jQuery-xxx.JS 在 eclipse 中报错的解决方案大多是说 项目右键 Properties->Validation->JSP Content Validator 这项的右边点击 ... 按钮, 然后点 Add Exclude Group-> 在 Exclude Group 点 Add Rule->Folder or file name 然后选到 jQuery-xxxx.JS 文件. 我试过了, 还是报错报红. 后来发现还有一个方法更有效, 原文如下
I have found that I can leave the JavaScript Validator enable and ignore specific files by adding a suitable exclusion pattern e.g. **/jQuery*.JS to the JavaScript/Include Path/Source/Excluded group (Project->Properties->JavaScript->Include Path->Source).
I found that I also needed to manually delete the old problem markers.
摘自 https://bugs.eclipse.org/bugs/show_bug.cgi?id=349020#c15
翻译过来就是
项目右键 Properties->JavaScript->Include Path->Source
然后点选你项目名称下得 webapp 里面的 Exclude:(None) 再点 Edit
把在 Exclude 里面点 add 把 **/jQuery*.JS 规则添加进去
保存后就好
然后把 jQuery-xxx.JS 里面剪切保存一下, 让错误消掉, 然后再粘贴回去, 保存
更多 Web 前端开发 https://www.html.cn/ 知识, 请查阅 HTML 中文网 !!
来源: http://www.css88.com/qa/jquery/16696.html