JQuery $(this) selector function and limitations

后端 未结 5 1140
南方客
南方客 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:10

    Use .find()

    $( this ).find( 'div' )
    

    Or use the context parameter to jQuery( selector, context ) (internally, it just calls find anyway...)

    $( 'div', this )
    

提交回复
热议问题