title | short-title | slug | l10n | ||
---|---|---|---|---|---|
Element: hasAttributes() メソッド |
hasAttributes() |
Web/API/Element/hasAttributes |
|
{{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()")}}