English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Metodo hasAttributes() del DOM HTML

Oggetto Elemento HTML DOM

hasAttributes()L'attributo restituisce un valore booleano true o false per indicare se l'elemento nodo corrente ha almeno un attributo (attribute).

Sintassi:

element.hasAttributes()
var p = document.getElementsByTagName("P")[0];
p.hasAttributes();
Prova a vedere‹/›

Compatibilità del browser

Tutti i browser supportano completamente il metodo hasAttributes():

Metodo
hasAttributes()

Dettagli tecnici

Valore di ritorno:Valore booleano, se l'elemento ha qualsiasi attributo, restituisce true, altrimenti false
Versione DOM:DOM 2° livello

Riferimenti correlati

Tutorial HTML:Attributi HTML

Riferimento HTML DOM:Metodo hasAttribute()

Riferimento HTML DOM:Metodo getAttribute()

Riferimento HTML DOM:Metodo setAttribute()

Riferimento HTML DOM:Metodo removeAttribute()

Oggetto Elemento HTML DOM