在 jQuery 中使用“this”关键字时,添加基本过滤器的语法是什么。
例如:
$(this):contains('foo')
$(this):visible OR $(this:visible)
最佳答案
用于搜索其中的项目:
$(':visible, any-selector', this)
$(this).find(':visible, any-selector')
如果您想要 true 或 false 返回:
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"');
}
关于Jquery 'this' 关键字和选择器的基本过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/966281/