$( "ul li" ).addClass(function( index ) { return "item-" + index; }); 转载于:https://my.oschina.net/u/1792175/blog/598006