Remove all attributes

后端 未结 9 683
天涯浪人
天涯浪人 2020-11-27 04:01

Is it possible to remove all attributes at once using jQuery?


to



        
9条回答
  •  无人及你
    2020-11-27 04:53

    A simple method that doesn't require JQuery:

    while(elem.attributes.length > 0)
        elem.removeAttribute(elem.attributes[0].name);
    

提交回复
热议问题