Skip to main content
Version: 3.35.1

hasAttribute

The hasAttribute method returns a boolean value indicating whether the specified attribute is present on the element.

Syntax

element.hasAttribute(attributeName);

Parameters

  • attributeName : string
    • The name of the attribute to check for.

Return value

A boolean value indicating whether the attribute is present.