A '$' in a variable means nothing special to the interpreter, much like an underscore.
(变量中的'$'对解释器来说没有什么特别之处,就像下划线一样。)
From what I've seen, many people using jQuery (which is what your example code looks like to me) tend to prefix variables that contain a jQuery object with a $ so that they are easily identified and not mixed up with, say, integers.
(从我所看到的,很多人使用jQuery (这是你的示例代码对我来说)倾向于为包含带有$的jQuery对象的变量添加前缀,以便它们易于识别并且不会与整数相混淆。)
The dollar sign function $()
in jQuery is a library function that is frequently used, so a short name is desirable.
(jQuery中的美元符号函数$()
是一个经常使用的库函数,因此需要一个简短的名称。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…