我需要隐藏全部<a>
带有文本或的元素innerHTML
匹配数字“foo”或使用 javascript 或 jQuery 的自定义值。
<li><a href="#" class="dir">foo</a></li>
我努力了
jQuery(document).ready(function() {
if (jquery().text().html("foo"){
('li >a').fadeOut()
}
});
$('a:contains(foo)').hide();
Done.
Or:
var customValue = "foo"
$('a').filter(function(){
return this.innerHTML === customValue;
}).fadeOut();
使用后面的选项,您可以对其进行更多自定义,例如:
var customValue = "foo"
$('a').filter(function(){
return this.innerHTML === customValue &&
$(this).closest('div').length;
}).fadeOut();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)