我有以下代码。
$(document).ready(function(){
$('#listing img')
.attr('width', 250)
.removeAttr('height').removeAttr('align').removeAttr('style')
.wrap('<p />');
});
有没有更有效的方法来删除多个属性?
发布于 2018-06-17 10:15:20
可以,您可以通过以下方式删除它:
$('#listing img').removeAttr('height align style');
您还可以添加这些属性,如下所示:
$('#listing img').attr({ height: "20", align: left }).css({ color: red, text-align: center });
https://stackoverflow.com/questions/13725301
复制相似问题