Is it possible to remove all attributes at once using jQuery?
to
A simple method that doesn't require JQuery:
while(elem.attributes.length > 0)
elem.removeAttribute(elem.attributes[0].name);
One-liner, no jQuery needed:
[...elem.attributes].forEach(attr => elem.removeAttribute(attr.name));
One-liner.
$('img').removeAttr(Object.values($('img').get(0).attributes).map(attr => attr.name).join(' '));