jQuery查找确切的HTML内容 [英] jQuery find exact HTML content
本文介绍了jQuery查找确切的HTML内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下脚本在适合幕帘条件的父ID容器中查找所有h1元素...
I am using the following script to find all h1 elements, within a parent ID container that will fit a curtain criteria...
$('#cpcompheader h1').html(" ").remove();
该脚本正在发现任何情况,例如......
That script is finding any scenario, such as....
<h1> </h1>
<h1> one two</h1>
<h1> the sun is up</h1>
<h1> etc...</h1>
但是我只想找到...的所有实例
But I only want to find all instances of...
<h1> </h1>
那么我应该如何修改我的代码?谢谢!
So how should I modify my code? Thanks!
推荐答案
您可以尝试查找所有h1标签,然后检查它们是否包含特定值.
You could try finding all the h1 tags and then checking if they contain a certain value.
$('#yourParent h1').each(function(){
if($(this).html() == " "){
// magic
}
});
这篇关于jQuery查找确切的HTML内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文