Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 781 Bytes

File metadata and controls

47 lines (31 loc) · 781 Bytes
title short-title slug l10n
Element: hasAttributes() メソッド
hasAttributes()
Web/API/Element/hasAttributes
sourceCommit
bbf7f25f9cf95fb154e2740a9fdc9c02818981bf

{{ApiRef("DOM")}}

hasAttributes() は {{domxref("Element")}} インターフェイスのメソッドで、現在の要素が属性を持っているか否かを論理値で返します。

構文

hasAttributes()

引数

なし。

返値

論理値です。

let foo = document.getElementById("foo");
if (foo.hasAttributes()) {
  // Do something with 'foo.attributes'
}

仕様書

{{Specifications}}

ブラウザーの互換性

{{Compat}}

関連情報

  • {{domxref("Element.attributes")}}
  • {{domxref("Element.hasAttribute()")}}