HTML DOM Element hasAttribute()
HTML DOM Element hasAttribute() Method
The hasAttribute() method is used to return true if the attribute exists. If it does not exist then it will return false.
Syntax:-
Its syntax is:- element.hasAttribute(name)
Return:-
Its return is:- true if element has attribute else false
Further Explanation:-
Parameter | Description |
name | Required. The name of the attribute. |