$('div').each(function(i,n){//i 下标;n 就是DOM节点 $(this).attr('id','hello_' + i); //等价于下面 //$(n).attr('id','hello_' + i); //n.id = 'hello_' + i; });
87,907
社区成员
224,614
社区内容
加载中
试试用AI创作助手写篇文章吧