阅读javascript脚本,为什么这么多$(美元符号)? [英] Reading a javascript script, why so many $ (dollar signs)?
问题描述
我正在尝试破译.js脚本,我发现它充满了整个$?有没有理由使用它?我是JavaScript新手。
I am trying to decipher a .js script and I am finding it filled with $ throughout? Is there any reason to use this? I'm pretty new to JavaScript.
推荐答案
我认为你正在阅读一个名为jQuery的JavaScript库(或者可能是另一个库) )。 $
只是命名空间的简短形式或用作标识符。
I think you are reading a JavaScript library famously known as jQuery (or possibly another library). The $
is just a short form for a namespace or use as an identifier.
您可以将其视为 jQuery('p')
来选择页面上的所有段落,
或简称你可以写 $('p')
。
You can think of it like this jQuery('p')
to select all the paragraphs on a page,
or for short form you can just write $('p')
.
这是一个jQuery教程/文档的链接 jQuery
Here is a link for jQuery tutorials/docs jQuery
这里是一份标准清单第7.6节详细描述了 ECMA标准
Here is a list of standards section 7.6 describes it in detail ECMA Standard
这篇关于阅读javascript脚本,为什么这么多$(美元符号)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!