1 $('.littleTaskBtn li').on('click',function(){ 2 var content=$('.content').html(); 3 $('.layui-timeline-item').css('display','block'); 4 $('#layui-timeline').append(content); 5 var lists = $('.layui-timeline-item'); 6 for (var j = 0; j < lists.length; j++) { 7 lists.eq(j).j = j; 8 var list = lists.eq(j).prevAll().length; 9 $('.layui-timeline-item').eq(j).find('span:eq(0)').text(list + 1); 10 } 11 })