我想增加 i 的值。 “for”循环不起作用。
$("a[href$='.xls']").appendTo(".xl1").attr('id','xl'+i);
我搜索所有 Excel 文件并将它们放入容器中并增加其 id 的值。
谢谢 吉恩
最佳答案
$("a[href$='.xls']").each(function(i) {
$(this).appendTo(".xl1").attr('id','xl'+i);
})
从i=0开始计数
您可以在这里阅读有关函数each()的信息http://api.jquery.com/each/
关于php - 使用 jquery 增加 attr 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2378410/