The $ dollar sign

后端 未结 9 1811
执笔经年
执笔经年 2020-11-29 04:16

I have something simple like this:

$(selector).append("somestuff");

But since I\'m going to reuse the selector I cache it with:

9条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 04:38

    "$" is a function in jQuery. So when you call $(selector), you're actually calling the function $ with selector as the argument.

    Generally, don't use the "$" as part of a variable name for javascript. You will only confuse yourself.

提交回复
热议问题