使用jquery选择最后一个子项,但不选择2个实例

使用jquery选择最后一个子项,但不选择2个实例,jquery,jquery-selectors,parent-child,Jquery,Jquery Selectors,Parent Child,我有两个div包含DL-DT-DD,我想选择div的最后一个DT。但它只从最后一个DIV中选择DT HTML: 问题是,jquery只从second DIV class=pack选择最后一个DT谢谢@Brad M每个方法都有效 $('.pack ul').each(function(){ $(this).find('li').last().css({"background" : "none" }); }); $('.pack dl').each(function(){

我有两个div包含DL-DT-DD,我想选择div的最后一个DT。但它只从最后一个DIV中选择DT

HTML:


问题是,jquery只从second DIV class=pack选择最后一个DT

谢谢@Brad M每个方法都有效

$('.pack ul').each(function(){
    $(this).find('li').last().css({"background" : "none" });
});
$('.pack dl').each(function(){
        $(this).find('dt').last().css({"background" : "none" });
    });

给div指定不同的ID
$('.pack ul').each(function(){
    $(this).find('li').last().css({"background" : "none" });
});
$('.pack dl').each(function(){
        $(this).find('dt').last().css({"background" : "none" });
    });