The $ dollar sign

后端 未结 9 1806
执笔经年
执笔经年 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:40

    I've seen it done both ways. All you are doing is creating a variable with the name '$selector', so they are functionally equivalent. The nice thing about it is that it does make them easy to pick out as jQuery objects.

提交回复
热议问题