jquery匹配唯一类名
我正在尝试使用jquery在wordpress的滑块中获得评论。我绝对不是专家,所以我请求一些帮助。这是我到目前为止所拥有的jquery匹配唯一类名,jquery,unique,match,classname,Jquery,Unique,Match,Classname,我正在尝试使用jquery在wordpress的滑块中获得评论。我绝对不是专家,所以我请求一些帮助。这是我到目前为止所拥有的 <div id="slider-1> <div id="content-805">content here</div> <div id="comments-wrap-805" class="comments-805"> //Parent <div id="commentform-798" class="comments
<div id="slider-1>
<div id="content-805">content here</div>
<div id="comments-wrap-805" class="comments-805"> //Parent
<div id="commentform-798" class="comments-798">comment stuff</div> //child
<div id="commentform-605" class="comments-605">comment stuff</div> //child
<div id="commentform-735" class="comments-735">comment stuff</div> //child
<div id="commentform-425" class="comments-425">comment stuff</div> //child
<div id="commentform-810" class="comments-810">comment stuff</div> //child
</div>
</div>
干杯你可以这样做
$.each($("div[id^='comments-wrap']"),function(){ // this will fetch all parent div's
var CurrectDiv=$(this);
CurrectDiv.find('div').filter(function(){
if($(this).attr('class')==CurrectDiv.attr('class'))
{
$(this).hide();
}
});
});
$.each($("div[id^='comments-wrap']"),function(){ // this will fetch all parent div's
var CurrectDiv=$(this);
CurrectDiv.find('div').filter(function(){
if($(this).attr('class')==CurrectDiv.attr('class'))
{
$(this).hide();
}
});
});