Javascript 如何验证我的 jQuery 脚本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5359893/
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
How can I validate my jQuery script?
提问by Web_Designer
I am looking for an online jQuery validator. Not a script that will validate my forms but an online tool with which I can give it some jQuery script and have it return syntax errors and other useful information. Thanks in advance!
我正在寻找一个在线 jQuery 验证器。不是一个可以验证我的表单的脚本,而是一个在线工具,我可以用它给它一些 jQuery 脚本并让它返回语法错误和其他有用的信息。提前致谢!
采纳答案by dmcnelis
Check out jsfiddle.net. You can paste in your Javascript, link in external libraries, and run your code through both a formatter and JSLint, which will identify any issues in the syntax of the code itself.
查看 jsfiddle.net。您可以粘贴您的 Javascript,链接到外部库,并通过格式化程序和 JSLint 运行您的代码,这将识别代码本身的语法中的任何问题。
It also provides a preview pane to go through more thorough functionality testing.
它还提供了一个预览窗格,以进行更彻底的功能测试。
回答by Mark Eirich
Try jQuery lint. Quoting the website:
试试jQuery lint。引用网站:
jQuery Lint is a simple script you can download and use with jQuery. It works over the top of jQuery and diligently reports errors and any incorrect usage of jQuery. It will also, to some extent, offer guidance on best practices and performance concerns.
jQuery Lint 是一个简单的脚本,您可以下载并与 jQuery 一起使用。它在 jQuery 之上工作,并认真报告错误和 jQuery 的任何不正确使用。在某种程度上,它还将为最佳实践和性能问题提供指导。
If you really need to use it online, you can do so on jsfiddle.
如果你真的需要在线使用它,你可以在jsfiddle上这样做。