--- title: Element.hasAttributes() slug: Web/API/Element/hasAttributes translation_of: Web/API/Element/hasAttributes ---
Метод Element.hasAttributes() возвращает Boolean значение, указывая содержит данный элемент какие-либо атрибуты или нет.
var result = element.hasAttributes();
resulttrue или false.var foo = document.getElementById("foo");
if (foo.hasAttributes()) {
// do something with 'foo.attributes'
}
;(function(prototype) {
prototype.hasAttributes = prototype.hasAttributes || function() {
return (this.attributes.length > 0);
}
})(Element.prototype);
{{Compat}}