开发者

Get last occurance in a <DIV>

开发者 https://www.devze.com 2022-12-16 22:20 出处:网络
I ha开发者_运维知识库ve the following JQUERY: $(function() { $(\'span .breadcrumb\').each(function(){

I ha开发者_运维知识库ve the following JQUERY:

$(function() {
    $('span .breadcrumb').each(function(){
        $('#footer').addClass($(this).text());
    });
});

So it reads the .breadcrumb and adds the text contained with text to #footer.

However .breadcrumb occurs a number of time with in the breadcrumb navigation, I want it to read just the second value with the class .breadcrumb - Possible?


Last one:

 $("span .breadcrumb:last") 

Second one:

 $("span .breadcrumb:eq(1)") 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号