Как удалить все атрибуты с помощью js или jquery. (Я не знаю, что это за атрибуты в теле, я хочу удалить их все)
Вы можете использовать свойство DOM Level 1 Core attributes
для доступа к атрибутам в виде списка. Как простой JS:
function removeAllAttrs(element) {
for (var i= element.attributes.length; i-->0;)
element.removeAttributeNode(element.attributes[i]);
}
removeAllAttrs(document.body);
Или одетый в одежду плагина jQuery:
$.fn.removeAllAttrs= function() {
return this.each(function() {
$.each(this.attributes, function() {
this.ownerElement.removeAttributeNode(this);
});
});
};
$('body').removeAllAttrs();
var $newBody = $('<body>');
$newBody.append( $('body').contents() );
$('body').replaceWith( $newBody );
Что-то вроде этого может сработать.