jQuery的attr方法中key,fn问题,求解!
console.log($("img").attr("name",function(){/*body...*/returnthis.class;}));结果不变:<img...
console.log($("img").attr("name", function () {
/* body... */
return this.class;
}));
结果不变:<img class="imgclass" src="img" alt="" name="imgName">
console.log($("img").attr("class", function () {
/* body... */
return this.name;
}));
结果变化:<img class="imgName" src="img" alt="" name="imgName"> 展开
/* body... */
return this.class;
}));
结果不变:<img class="imgclass" src="img" alt="" name="imgName">
console.log($("img").attr("class", function () {
/* body... */
return this.name;
}));
结果变化:<img class="imgName" src="img" alt="" name="imgName"> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询