Your snippet of code looks like it's referencing methods from one of the popular JavaScript libraries (jQuery, ProtoType, mooTools, and so on).(您的代码段看起来像是来自一种流行的JavaScript库(jQuery,ProtoType,mooTools等)的引用方法。)
There's nothing mysterious about the use of $
in JavaScript.(在JavaScript中使用$
并没有什么神秘之处。) $
is simply a valid JavaScript identifier.($
只是有效的JavaScript标识符。)
JavaScript allows upper and lower letters, numbers, and $
and _
.(JavaScript允许使用大小写字母,数字以及$
和_
。) The $
was intended to be used for machine-generated variables (such as $0001
).($
打算用于机器生成的变量(例如$0001
)。)
Prototype, jQuery, and most javascript libraries use the $
as the primary base object (or function).(原型,jQuery和大多数javascript库都使用$
作为主要基础对象(或函数)。) Most of them also have a way to relinquish the $
so that it can be used with another library that uses it.(他们中的大多数人也有放弃$
的方法,以便可以将其与使用它的另一个库一起使用。) In that case you use jQuery
instead of $
.(在这种情况下,您将使用jQuery
而不是$
。) In fact, $
is just a shortcut for jQuery
.(实际上, $
只是jQuery
的快捷方式。) 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…