Remove multiple attributes with jQuery's removeAttr

前端 未结 2 1357
-上瘾入骨i
-上瘾入骨i 2021-02-02 05:12

I have the following code.

$(document).ready(function(){
 $(\'#listing img\')
 .attr(\'width\', 250)
 .removeAttr(\'height\').removeAttr(\'align\').removeAttr(\'         


        
2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-02 05:17

    Yes :

    .removeAttr('height align style')
    

    From the documentation :

    as of version 1.7, it can be a space-separated list of attributes.

提交回复
热议问题