在下面显示的html中,我有这个主div,cxfeeditem feeditem
并且there are many divs
具有相同的类名和结构。我的问题是所有以类名开头的div cxfeeditem feeditem
,如何获取孩子的值,
1.类名 cxfeeditem feeditem
2.class=feeditemtimestamp
3.cxcomments feeditemcomments
4.cxfeeditem feeditem
<div class="cxfeeditem feeditem">
<span class="feeditemtext cxfeeditemtext">
This is my blog
</span>
<a class="feeditemtimestamp">Yesterday 2:13PM</a>
<div class="cxcomments feeditemcomments">
These are my comments
</div>
<div class="cxfeeditem1 feeditem1">
My comments for the comment
</div>
</div>
编辑:输出我想提醒以下值:
This is my blog
Yesterday 2:13PM
These are my comments
My comments for the comment
我尝试了以下但它返回null:
$("div.cxfeeditem.feeditem").each(function() {
alert($(this).children('span.feeditemtext.cxfeeditemtext').html());
alert($(this).children('a.feeditemtimestamp').html());
alert($(this).children('div.cxcomments.feeditemcomments').html());
alert($(this).children('div.cxfeeditem.feeditem').html());
break;
});