X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM hasAttributes() Method

Element Object Reference Element Object

Example

See if the body element has any attributes:

document.body.hasAttributes()

The result will be:

false

Try it yourself »


Definition and Usage

The hasAttributes() method returns true if the specified node has any attributes, otherwise false.

If the specified node is not an Element node, the return value is always false.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The hasAttributes() method is supported in all major browsers.

Note: Internet Explorer 8 and earlier does not support this method.


Syntax

node.hasAttributes()

Parameters

None

Return Value

Type Description
Boolean true if the node has attributes, otherwise false

Technical Details

DOM Version Core Level 2 Node Object


Element Object Reference Element Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook