jQuery $(this) keyword

后端 未结 6 1159
没有蜡笔的小新
没有蜡笔的小新 2020-11-27 15:17

Why is it important to use $(this) instead of re-selecting the class?

I am using a lot of animate and css editing in my code, and I know I can simplify it by using

6条回答
  •  心在旅途
    2020-11-27 15:45

    using $(this) improves performance, as the class/whatever attr u are using to search, need not be searched for multiple times in the entire webpage content.

提交回复
热议问题