JQuery学习之each方法

来源:互联网 发布:headfirst python中文 编辑:程序博客网 时间:2024/05/16 17:00
each方法可以遍历某个集合,例如:
    $(".box ul li").each(function(i){
        var width = $(this).width();
        $(this).width(width + 50);
    });

以上代码遍历了所有li,设置每个li的宽度在其原有基础上增加50像素。




原创粉丝点击