Jquery'this'关键字和选择器的基本过滤器

Chr*_*man 5 jquery

在jQuery中使用' this '关键字时,添加基本过滤器的语法是什么.

例如:

$(this):contains('foo')

$(this):visible OR $(this:visible)
Run Code Online (Sandbox Code Playgroud)

Lat*_*han 6

用于搜索此内的项目:

$(':visible, any-selector', this)
$(this).find(':visible, any-selector')
Run Code Online (Sandbox Code Playgroud)

如果你想要一个真或假的回报:

if($(this).is(':visible, any-selector')){
    alert('this is visible, or matches "any-selector"');
    }
else{
    alert('this is hidden, or doesn\'t match "any-selector"');
    }
Run Code Online (Sandbox Code Playgroud)