JQuery $(this) selector function and limitations

后端 未结 5 1151
南方客
南方客 2020-12-01 08:31

I need help understanding $(this). Is it possible to narrow the focus of \'this\' within the parentheses or does \"this\" preclude the use of any other attributes?

5条回答
  •  情歌与酒
    2020-12-01 09:15

    this is not a string representing a css selector(such as div,#my_id or .my_class).
    When passing this as a argument for the jQuery function, it returns a jQuery object based on the current element(what this referes to), so you cannot use something like $(this + selector).

提交回复
热议问题