且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JavaScript中的'#'符号是什么意思?

更新时间:2022-06-25 05:08:27

在JavaScript中?没什么特别的。它只是字符串的一部分。

In JavaScript? Nothing special. It is just part of a string.

$ 函数可能会对它做一些事情,但很难说 $ 函数是什么

The $ function might do something with it, but it is hard to tell what the $ function is.

有很多库提供 $ 函数,它充当该库的厨房接收器。它们包括原型, Mootools jQuery 。这个看起来最像jQuery,在这种情况下,参数是一个包含 CSS选择器,所以表示 id选择器。

There are a lot of libraries which provide a $ function that acts as a kitchen sink for that library. They include Prototype, Mootools and jQuery. This one looks most like jQuery, in which case the argument is a string containing a CSS selector, so the # indicates the start of an id selector.

此选择具有给定id属性的单个元素。

This "Selects a single element with the given id attribute".